Skip to content

fix(plugin-grid): resolve off-spec rowHeight at the state boundary instead of styling it as medium (#4443) - #4458

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-4443-objectgrid-rowheight-boundary
Aug 12, 2026
Merged

fix(plugin-grid): resolve off-spec rowHeight at the state boundary instead of styling it as medium (#4443)#4458
yinlianghui merged 1 commit into
mainfrom
claude/issue-4443-objectgrid-rowheight-boundary

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Closes#4443

The defect

ObjectGrid seeded its density state with schema.rowHeight ?? 'compact', so one component answered one question two ways:

  • absentrowHeight lands on compact
  • off-specrowHeight skips every arm of the density ternaries and comes out at their terminal else — the medium styling

That is the absent-vs-off-spec split #4440 removed from ListView, and it made a standalone grid the third answer to a question the rest of the system had already settled: @object-ui/core's rowHeightToDensityMode abstains for an off-spec value, the @object-ui/react spec bridge (#4352) abstains, and ListView defaults that abstention to compact.

Only the standalone path is affected. When ListView owns the grid it overwrites the prop with a value derived from density.mode, so nothing off-spec survives that hop.

The fix — narrow at the boundary (ruling option 1)

One resolver that admits only the five spec row heights, applied at both entry points that feed author-supplied rowHeight into the state:

  1. the initial useState seed, and
  2. the effect that re-syncs when the rowHeight prop changes (e.g. a parent ListView's density toggle) — this was a second unvalidated writer, now routed through the same resolver.

The ternary chains are deliberately untouched: medium stays a real row height with its own styling arm, and a leaf renderer's terminal else stays that arm. What changes is that nothing unrecognized can reach it.

Membership is tested against ROW_HEIGHT_TO_DENSITY_MODE rather than a local list, so the admitted values keep one definition in the repo; that table is typed Record< RowHeight, DensityMode >, so the build fails if the spec grows a sixth row height without the resolver being taught about it. hasOwnProperty, not in — same reason @object-ui/core uses it.

Red-first, and a correction to the issue's premise

The two off-spec spellings failed differently before this change, which the issue did not distinguish. Both are covered, and the boundary fix closes both:

  • 'toString' rendered as medium — the defect exactly as filed. The toolbar's row-height icon map is looked up by the same unvalidated state, and a prototype member resolves through that map's prototype chain to Object.prototype.toString, a function React accepts as a component. So it survived to the ternaries.
  • 'garbage' did not render at all — it is not a key of the icon map either, so the lookup produced undefined and rendering the icon threw Element type is invalid. The toolbar is shown precisely when schema.rowHeight is defined, so this crash and the off-spec case coincide exactly.

The issue's "renders an off-spec rowHeight as medium" is therefore true only for prototype-member spellings; a plain off-spec value crashed the standalone grid. Verbatim pre-fix red (5 failed, 6 passed):

AssertionError: data cell should carry compact token "py-1" (column-level copy),
got "... px-3 py-1.5 h-11 text-[13px] leading-normal ...": expected false to be true
Error: Element type is invalid: expected a string (for built-in components) or a
class/function (for composite components) but got: undefined.
Check the render method of `ObjectGrid`.

Post-fix: 11 passed (11).

Both ternary copies are asserted independently

They are separately observable in the DOM, so neither assertion is vacuous:

  • the column-level copy (rowHeightCellClass) is the only one carrying the h-* row-height floor, and lands on the data columns — h-9 vs h-11;
  • the table-level copy (dataTableSchema.cellClassName) is the default for columns declaring none — the narrow row-number column — and carries padding/leading only, no h-*.

Verification

  • pnpm vitest run packages/plugin-grid/src/__tests__/rowHeightOffSpecBoundary.test.tsx — red first (5 failed / 6 passed), green after (11 passed)
  • pnpm vitest run --maxWorkers=2 packages/plugin-grid — 60 files, 571 passed
  • tsc --noEmit and tsc -p tsconfig.test.json — both clean
  • pnpm --filter @object-ui/plugin-grid lint — 0 errors
  • check:control-bytes, check:phantom-deps, check:spec-symbols — all green
  • Emitted .d.ts diffed before/after the change: byte-identical, so the changeset is patch as graded, no escalation to minor

Generated by Claude Code

…stead of styling it as medium (#4443)
ObjectGrid seeded its density state with `schema.rowHeight ?? 'compact'`, so
one component answered one question two ways: an ABSENT rowHeight landed on
`compact`, an OFF-SPEC one skipped every arm of the density ternaries and came
out at their terminal `else` — the `medium` styling. That is the
absent-vs-off-spec split #4440 removed from ListView, and it made a standalone
grid a third answer to a question `@object-ui/core` (`rowHeightToDensityMode`,
abstains) and the `@object-ui/react` spec bridge (#4352, abstains) had already
settled.
Both entry points — the initial state and the effect that re-syncs when the
prop changes — now go through one resolver that admits only the five spec row
heights, guarded with `hasOwnProperty` rather than `in`. The ternary chains are
untouched: `medium` stays a real value and the terminal `else` stays its arm.
Red-first, and the two off-spec spellings failed differently before the fix:
`'toString'` reached `Object.prototype.toString` through the toolbar icon map's
prototype chain and rendered as medium (the defect as filed), while a plain
`'garbage'` was not a key of that map either, so `<RowHeightIcon />` was
`undefined` and the standalone grid threw `Element type is invalid` rather than
rendering as medium at all. Both are inert now.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Qqyix2QcnpUC9XeYVDzx3
@vercel

vercelBot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 12, 2026 9:35am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)24.7 KB350 KB
Entry fileindex-DZAJo77R.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)9.56KB3.59KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)8.92KB3.41KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)489.32KB108.45KB
core (index.js)2.99KB1.14KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)153.42KB41.19KB
fields (index.js)228.99KB56.82KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)3.35KB1.38KB
i18n (pickLocalized.js)3.69KB1.73KB
i18n (provider.js)23.12KB7.62KB
i18n (useDisplayLocale.js)2.33KB1.20KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)7.77KB3.13KB
layout (index.js)38.98KB10.85KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.75KB3.80KB
plugin-calendar (index.js)45.23KB12.45KB
plugin-charts (index.js)62.01KB17.63KB
plugin-chatbot (index.js)181.17KB43.03KB
plugin-dashboard (index.js)120.75KB31.38KB
plugin-designer (index.js)212.58KB42.83KB
plugin-detail (index.js)239.03KB59.77KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)114.58KB27.68KB
plugin-gantt (index.js)164.14KB39.98KB
plugin-grid (index.js)188.13KB50.00KB
plugin-kanban (index.js)48.62KB13.42KB
plugin-list (index.js)110.20KB26.79KB
plugin-map (index.js)18.16KB5.81KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.99KB10.74KB
plugin-timeline (index.js)26.21KB7.52KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.08KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)23.73KB7.96KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.23KB0.66KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (dashboard-filter-alias.js)6.23KB2.74KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)3.05KB1.52KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

ACCEPT — step-7 复核 by PM session session_017Qqyix2QcnpUC9XeYVDzx3 (wind-down mode, focused review).

  • Red-first before any source edit: 5 red / 6 green, with the 6 being exactly the must-not-change direction (absent → compact, five in-spec values), all still green post-fix.
  • Severity re-grade accepted into the record: the card's "observation-class, renders as medium" framing was an undercount. Measured pre-fix, a plain off-spec rowHeight was a hard render crash on the standalone grid (rowHeightIcons[rowHeightMode]undefinedElement type is invalid), and since the toggle shows precisely when rowHeight is authored, the crash surface coincided exactly with the off-spec surface; only prototype-member spellings survived to the medium ternary via the icon map's prototype chain. This was a latent defect, not an observation — unreachable today only by the three-repo zero-authored-off-spec sweep. Both shapes fixed and pinned in this PR; correctly not filed separately.
  • One-resolver discipline done properly: the re-sync effect (a second unvalidated writer the card didn't mention) routed through the same resolver and pinned red-first; cycleRowHeight correctly exempt (fixed literal cycle). Reusing core's ROW_HEIGHT_TO_DENSITY_MODE as the single definition of the admitted set — with Record<RowHeight, …> failing the build if the spec grows a sixth value — is the derivation-over-enumeration shape this family wants.
  • Both ternary copies independently observable and asserted with exact token matching (py-1 vs py-1.5 prefix trap avoided). .d.ts byte-identical → patch stands. CI 18/18 green.

Flipping ready + arming auto-merge. Slot NOT refilled per maintainer's wind-down instruction. rowHeight family state after this lands: core, bridge, ListView, and standalone ObjectGrid all give one answer on off-spec strings; #4459 (non-string coercion in the bridge) remains the pooled residual.


Generated by Claude Code


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 12, 2026 10:39
@yinlianghui
yinlianghui added this pull request to the merge queueAug 12, 2026
Merged via the queue into main with commit 5e514c4Aug 12, 2026
21 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-4443-objectgrid-rowheight-boundary branch August 12, 2026 10:40
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

finding(plugin-grid): a standalone ObjectGrid still renders an off-spec rowHeight as medium, the third answer to the question #4440 unified

2 participants

@yinlianghui@claude