Skip to content

fix(database): prevent React #31 crash when opening models with object values - #305

Merged
kkopanidis merged 2 commits into
ui-rewritefrom
cursor/fix-model-detail-object-render-d73e
Aug 11, 2026
Merged

fix(database): prevent React #31 crash when opening models with object values#305
kkopanidis merged 2 commits into
ui-rewritefrom
cursor/fix-model-detail-object-render-d73e

Conversation

@kkopanidis

Copy link
Copy Markdown
Contributor

Summary

Opening a model detail page crashed with React error #31 when a schema default or document field contained a plain object such as { startDate, endDate, nights }. React cannot render objects as children; the UI was passing those values straight into JSX in a few places (and schema field defaults were not normalized for text inputs).

Changes

  • Add formatDisplayValue / formatCellDisplayValue / normalizeFieldDefault helpers
  • Normalize schema field defaults and types when loading into the schema editor
  • Restore JSON/Number/Boolean defaults correctly on save
  • Coerce document grid, document panel, relation picker, and filter chip values to strings before render
  • Fix createdAt/updatedAt tooltip content that rendered raw cell values

Test plan

  • Open a model whose schema has a JSON field with an object default — schema tab should load without crashing; default shows as JSON text
  • Open Data for a model with documents containing nested objects like { startDate, endDate, nights } — grid renders a JSON preview badge instead of crashing
  • Hover createdAt/updatedAt tooltips — tooltip text is a string
  • Open a document with a Relation field and object-valued display fields on related docs — picker labels stay strings
  • Edit and save a JSON default — object shape is preserved when valid JSON is entered
Open in Web Open in Cursor 

Model detail crashed when schema defaults or document fields contained
plain objects (e.g. { startDate, endDate, nights }) because those values
were rendered as React children. Normalize defaults for the schema editor
and coerce document/relation values through a shared display formatter.
Drop unnecessary comments, over-guards, and a formatDisplayValue use in
document-panel that would have broken datetime-local inputs.
@kkopanidis
kkopanidis marked this pull request as ready for review August 11, 2026 14:24
@kkopanidis
kkopanidis merged commit 5f73454 into ui-rewrite Aug 11, 2026
2 checks passed
@kkopanidis
kkopanidis deleted the cursor/fix-model-detail-object-render-d73e branch August 11, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants