Uh oh!
There was an error while loading. Please reload this page.
Fix CRM example field naming to comply with snake_case convention - #310
Merged
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI
changed the title
[WIP] Fix CI build and test issuesFix CRM example field naming to comply with snake_case conventionJan 31, 2026
hotlong
marked this pull request as ready for review
January 31, 2026 19:13
Uh oh!
There was an error while loading. Please reload this page.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the CRM example’s Opportunity object field names to snake_case to satisfy ObjectStack schema validation and prevent CI failures.
Changes:
- Renamed Opportunity object fields from camelCase to snake_case (
close_date,account_id,contact_ids). - Updated seeded opportunity records in the CRM example stack config to use the renamed fields.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| examples/crm/src/objects/opportunity.object.ts | Renames Opportunity field keys to snake_case to comply with compiler validation rules. |
| examples/crm/objectstack.config.ts | Updates example opportunity seed data to match the renamed schema fields. |
7 tasks
CopilotAI
added a commit
that referenced
this pull request
Mar 3, 2026
The useMemo hook was placed after conditional early returns in RecordDetailView, violating React's Rules of Hooks and causing "Rendered fewer hooks than expected" (React error #310). Replaced with an IIFE to keep the same Set-based dedup logic without hooks. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI
added a commit
that referenced
this pull request
Mar 5, 2026
… React error #310 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI
added a commit
that referenced
this pull request
Mar 5, 2026
…atting to prevent React error #310 Instead of routing highlight values through full CellRenderer components (which may not handle all data shapes from the API), use direct string formatting functions (formatCurrency, formatDate, etc.) that guarantee only primitives reach JSX. All values are coerced through toSafeString() first, which safely handles MongoDB types, expanded references, arrays of objects, and other non-primitive values. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI
added a commit
that referenced
this pull request
Mar 5, 2026
…Highlight to use getCellRenderer The proper architectural fix for React error #310: instead of working around unsafe renderers in HeaderHighlight, fix the renderers themselves. Added coerceToSafeValue() utility in @object-ui/fields that safely coerces MongoDB wrapper types ($numberDecimal, $oid, $date), expanded reference objects, arrays, and Date instances to primitive values. Applied coerceToSafeValue in: NumberCellRenderer, CurrencyCellRenderer, PercentCellRenderer, TextCellRenderer, EmailCellRenderer, UrlCellRenderer, PhoneCellRenderer, FormulaCellRenderer, DateCellRenderer, DateTimeCellRenderer. HeaderHighlight reverted to use getCellRenderer for type-aware rendering, since all renderers are now safe against non-primitive values. 16 new tests for coerceToSafeValue and cell renderer object safety. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI
added a commit
that referenced
this pull request
Mar 9, 2026
… error #310 The useMemo hook for detailSchema was placed after conditional early returns (isLoading / !objectDef), causing an inconsistent hook count across renders. React error #310 ("Rendered more hooks than during the previous render") was triggered when transitioning from an early-return render to a full render. Move the useMemo before the early returns with a guard clause for !objectDef inside the callback. All intermediate computation (primaryField, sections, highlightFields, etc.) is folded into the useMemo since those variables are only consumed by detailSchema. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
5 tasks
os-zhuang pushed a commit
that referenced
this pull request
Jul 5, 2026
os-zhuang pushed a commit
that referenced
this pull request
Sep 2, 2026
A `code` value whose TEXT is JSON rendered as the literal `[Object]`. The
showcase Field Zoo record's Code Editor field (`f_code`) stores the string
`{\n "ok": true\n}` and the detail page showed `[Object]`.
`coerceToSafeValue` parsed any string starting `{`/`[` and ending `}`/`]`,
then ran the result through the reference-label extraction
(`name || label || externalId || id || _id || '[Object]'`). An object carrying
none of those keys answers the placeholder. Every text-like cell reaches this
helper — `text`, `textarea`, `code`, `time`, `auto_number` and `qrcode` all
register to `TextCellRenderer` — so all of them lost JSON-shaped text, and
`[1, 2, 3]` in a text field rendered as `1, 2, 3`.
Shape is not a type. A string is now returned verbatim. The reference case the
parse was written for (#1426, an unresolved external-id ref arriving as
`'{"externalId":"…"}'`) belongs to reference-TYPED columns and already lives
there: `LookupCellRenderer` carries its own JSON-string branch that resolves the
label through the referenced object's schema and links to the record — neither
of which the type-blind helper could do. Scoped, not dropped.
Object and array VALUES still coerce, so React error #310 stays fixed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ObjectStack compiler enforces snake_case field naming but the CRM example's OpportunityObject used camelCase, causing validation failures:
Changes
Renamed fields in
examples/crm/src/objects/opportunity.object.ts:closeDate→close_dateaccountId→account_idcontactIds→contact_idsUpdated corresponding data records in
examples/crm/objectstack.config.tsto match new field names.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.