Skip to content

fix(app-shell): each toolbar save starts from the row the store holds, so a second change keeps the first (objectui#11642) - #11646

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-11642-view-save-base
Oct 5, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-11642-view-save-base

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #11642

Clause-②: no

What changed

persistViewPatch (packages/app-shell/src/views/ObjectView.tsx) sends each grid toolbar change as a whole-document PUT /api/v1/meta/view/NAME. It built every body from the active tab as it was when the page loaded, or, for an overlay, from the pending patch alone. Nothing moved that base after a write landed, so a second change in one session dropped the first, on every row kind.

Each write now starts from the row the store holds when the write runs:

  • A new module-private helper, toolbarWriteInputs, reads the row through loadViewOverrides, the same reader the page load uses.
  • Saved view (an envelope row or a flat row): the row read back is the base buildPersistedViewBody places the patch on. The tab is the base only when no row was read (a draft-only view in preview mode, or a failed read). That is the old behaviour.
  • Overlay: the stored overlay's own keys are joined with the pending patch. Those are the keys VIEW_OVERLAY_OWNED_KEYS names, the set loadViewOverrides narrows a marked overlay to. The tab still supplies viewKind only, so the body still carries nothing the shadowed view owns (objectui#5233).
  • Writes to one view are chained. A write waits for the previous write to that view to settle before it reads, so it never reads the row from before that write.
  • The 300 ms debounce is unchanged: two changes inside it are still one write.

buildPersistedViewBody keeps its shapes; its doc now says what the caller hands it. No export, prop, type member or i18n key is added, and the server side is untouched.

Where the stored row comes from

Measured on the wire against objectstack main a3ffc451 (showcase app, objectstack dev --seed-admin --fresh):

  • The PUT /api/v1/meta/view/NAME answer carries no row: { success, version, seq, state, message }, the shape SaveMetaItemResponseSchema declares.
  • The body sent is not what the door kept. A probe PUT with rowHeight beside config, and a sort entry carrying a row id, read back without the top-level rowHeight and without the id (ADR-0005 appendix (c)).
  • The single read GET /api/v1/meta/view/NAME and the list read GET /api/v1/meta/view returned the same stored item.

So the source is a read-back: the list read GET /api/v1/meta/view, through loadViewOverrides, taken when each write runs. The adapter drops that read's cache on every view write (invalidateViewKeys), so the read after a write returns the post-write row. The live runs show it: each run's second PUT follows one GET /api/v1/meta/view, and the first PUT adds no request because it reads the cache the page load filled.

Reading when the write runs, instead of keeping a copy of the row after each write, also composes with a row another handler on the page wrote in between (set as default, pin, rename), and leaves no copy to keep fresh.

Measured live, before and after

Stack: the console from this worktree (Vite, workspace src aliases) against objectstack main a3ffc451, showcase app, fresh database, admin session, Chromium. Each run opens the view, toggles density, waits 1.5 s (past the debounce and the round trip), clicks the Title header sort, captures both PUTs, reads the row back with GET /api/v1/meta/view/NAME, then reloads in a fresh browser context. "Before" ran the base 59917c4. "After" ran the final head 5af8b90; the fix commit 096bbf3 gave the same readings. Rows were reset between runs.

Row kind Before: 2nd PUT · stored row · reload After: 2nd PUT · stored row · reload
Envelope: stock showcase_task.in_progress config.sort only · config.sort, no rowHeight · "Density: Compact", sort kept config.rowHeight: "medium" and config.sort · both · "Density: Comfortable", data request sort=title
Flat saved row: showcase_task.flat_probe, seeded by PUT with viewKind: "list", no config, no marker top-level sort only · sort, no rowHeight · "Density: Compact" top-level rowHeight: "medium" and sort · both · "Density: Comfortable", sort=title
Overlay on showcase_task.done, seeded as the marked overlay { rowHeight: "compact", viewKind, object, name, _isOverride } { sort, viewKind, object, name, _isOverride } · sort, no rowHeight · "Density: Compact" { rowHeight: "medium", sort, viewKind, object, name, _isOverride } · both · "Density: Comfortable", sort=title
Envelope, the two changes 100 ms apart (inside the debounce) not run ONE PUT carrying config.rowHeight and config.sort · both · "Density: Comfortable"

Every PUT answered 200. No overlay PUT body carried filter, columns, label or config.

Tests

  • New: ObjectView.toolbarWritesCompose-11642.test.tsx. It mounts the real object page with the real persistViewPatch and its debounce, over the real ObjectStackAdapter. The adapter's metadata client is a store that judges every PUT with the spec's ViewMetadataSchema, keeps the parsed value of the keys the body carried, and answers with no row, as the door does. ListView is stubbed to capture the schema, so a change is the page's own onDensityChange / onSortChange call. A reload remounts the page over a fresh adapter on the same store.
    • The card's Done-when, once per row kind (envelope, flat, overlay): density, a wait, then a sort. The second PUT body, the stored row and the reloaded relay (rowHeight, sort) all carry both changes. The overlay case also asserts that no body carries a source key, and that the earlier session's columnState rides along.
    • Debounce: two changes 50 ms apart give one write carrying both.
    • In flight: the first PUT takes 500 ms and the sort comes 400 ms after the density, so the second debounce fires mid-PUT. The second write still starts from the row the first one stored.
  • One-shot ablations at 5af8b90, each through ablation-replace.mjs in wrap mode. Each reported the anchor hit once and the blob changed, then restored the HEAD blob with an empty git diff HEAD.
    • A puts the pre-fix base back: the tab for a saved view, the pending patch alone for an overlay, chain kept. The direction written before the run: the three row-kind cases and the in-flight case red on the density, the coalescing case green. Observed Tests 4 failed | 28 passed (32), every failure expected undefined to be 'medium'. The coalescing case, ObjectView.densityInsideConfig-11625.test.ts and ObjectView.overlayPatchOnly.test.ts stayed green.
    • B removes the chain and keeps the read at write time. Predicted and observed: only the in-flight case red, Tests 1 failed | 4 passed (5).
  • Gates at 5af8b90, the final head, each exit code written to a file as it landed:
    • Ten targeted files, pnpm exec vitest run over the new pin, writeRefusalCensus-11583.test.ts, ObjectView.densityInsideConfig-11625.test.ts, ObjectView.overlayPatchOnly.test.ts, ObjectView.viewWriteRefusal-11583.test.tsx, ObjectView.densityModeThroughFold-7924.test.tsx, ObjectView.viewOverrides.test.tsx, ObjectView.setDefaultViewIdentity.test.tsx, InterfaceListPage.hollowOverlayHydration.test.tsx and ObjectView.emptyColumnsNoProjection-10694.test.tsx: Test Files 10 passed (10), Tests 104 passed (104).
    • pnpm --filter @object-ui/app-shell type-check (tsc --noEmit && tsc -p tsconfig.test.json, dependency closure built first with turbo run build --filter='@object-ui/app-shell^...'): exit 0. The test config covers the new pin: an earlier run refused an unused parameter in it (TS6133), fixed in 000c155.
    • pnpm --filter @object-ui/app-shell lint: exit 0, 0 errors.
    • pnpm exec vitest run packages/app-shell/: exit 0, Test Files 1003 passed | 1 skipped (1004), Tests 9966 passed | 9 skipped (9975).
    • Root gates, exit 0 each: check:new-line-citations, check:control-bytes, check:test-path-roots, check:vi-mock-specifiers, check:vi-mock-inherit, check:vi-mock-override-shape, check:metadata-write-doors, check:changeset-claims, check:pending-changeset-literals, check:handler-key-reads, check:unreferenced-sources, check:shell-escape-residue, scripts/check-changeset-presence.mjs and scripts/check-changeset-no-major.mjs. A control-byte scan of the three changed files found nothing.
  • A census the first cut tripped. writeRefusalCensus-11583.test.ts keys each metadata write by its nearest named function. The first cut ran the write through a named local function, so the census read it under that name. The app-shell suite at the merge head 75d028f caught it (Tests 2 failed, both in that census). The chain is now one assignment with an anonymous step, so the write stays keyed under persistViewPatch with its refusal path on the .catch. The census ledger is unchanged.

Acceptance notes

  • Consequence: the first toolbar write on a page no longer carries the tab's decorations. The first body used to be the tab: flattened columns, type, data and filter, plus the tab's id and isDefault. The door dropped most of them, but isDefault landed: in the before-runs the stored row gained an isDefault key after a density toggle. The first body is now the stored row, so a toolbar change writes only what the user changed.
  • Consequence, NOT MEASURED live: preview mode. With ?preview=draft the active tab can carry a pending draft. A toolbar write used to build the active row from that tab, which published the draft's content without the Publish step. It now starts from the published row. Not driven live.
  • Cost. After a page's first toolbar write, each toolbar write adds one GET /api/v1/meta/view (the list read) before its PUT. Toolbar writes are debounced, so that is one read per settled change.
  • Fallback. When the read returns no row for the view, a saved view's write falls back to the tab and an overlay's write to the pending patch alone. That is the old behaviour.
  • Not changed, seen again: an overlay row takes the served view's place on read. After the overlay runs on showcase_task.done, the reloaded data request carries no status = done filter. PR objectui#11639's Acceptance notes reported this to the seat. This change neither causes nor repairs it.
  • Observation, no card (zero pull). ObjectStackAdapter.updateViewConfig's doc says it returns the persisted item when the server echoes one and undefined otherwise. The door never echoes a row, and the method returns the save answer object instead of undefined. Its only caller ignores the return. Carrier: none.

Session: https://claude.ai/code/session_015W8GBu6sBiqus2L2xjMsAL


Generated by Claude Code

claude added 4 commits October 5, 2026 06:15
…, so a second change keeps the first

`persistViewPatch` sent every whole-document PUT from the tab as it was at
page load, or from the pending patch alone for an overlay, and nothing moved
that base after a write landed. A second toolbar change in one session
therefore dropped the first, on the envelope row, the flat row and the
overlay.

Each write now reads the stored row through `loadViewOverrides` when it
runs (the PUT answer carries no row, and the door drops undeclared keys),
places the patch on it for a saved view, and composes the stored overlay's
own keys with the patch for an overlay. Writes to one view are chained so a
write never reads the row from before the previous one landed.

Claude-Session: https://claude.ai/code/session_015W8GBu6sBiqus2L2xjMsAL
Co-authored-by: Claude <noreply@anthropic.com>
…nused in the objectui#11642 pin

`tsc -p tsconfig.test.json` refused it (TS6133).

Claude-Session: https://claude.ai/code/session_015W8GBu6sBiqus2L2xjMsAL
Co-authored-by: Claude <noreply@anthropic.com>
… for the write-refusal census

The chained write ran through a named local `write` function, so
`writeRefusalCensus-11583.test.ts` keyed the `updateViewConfig` call under
`write` and found none under `persistViewPatch`. The chain is now one
assignment with an anonymous step, and the new helper types its rows as
`Record<string, unknown>`.

Claude-Session: https://claude.ai/code/session_015W8GBu6sBiqus2L2xjMsAL
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 331 chunks) 3317.4 KB 3330.4 KB
Main entry chunk (gzip) 151.8 KB 350 KB
Entry file index-DK0N1kIJ.js —
Status PASS —

The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it.


📦 Bundle Size Report

Package Size Gzipped
app-shell (consoleActionDispatch.js) 0.20KB 0.19KB
app-shell (index.js) 17.22KB 6.37KB
app-shell (runtime-config.js) 22.52KB 7.86KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.11KB 3.87KB
auth (ActiveOrganizationStorage.js) 27.95KB 10.04KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 2.07KB 1.00KB
auth (AuthProvider.js) 40.22KB 10.61KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.17KB 5.40KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.72KB 2.24KB
auth (SocialSignInButtons.js) 9.70KB 3.93KB
auth (UserMenu.js) 3.39KB 1.21KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 40.70KB 10.94KB
auth (createAuthenticatedFetch.js) 8.54KB 3.46KB
auth (index.js) 3.63KB 1.64KB
auth (invitation-status.js) 1.22KB 0.70KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 5.30KB 1.02KB
auth (useWorkspaceAdminStatus.js) 11.08KB 4.58KB
collaboration (CommentThread.js) 27.11KB 7.97KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.28KB 2.60KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.50KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 574.98KB 137.97KB
core (index.js) 10.00KB 3.96KB
create-plugin (index.js) 27.94KB 9.51KB
data-objectstack (index.js) 232.57KB 64.51KB
fields (index.js) 262.75KB 66.62KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (builtinAggregateLabels.js) 0.86KB 0.49KB
i18n (currency.js) 2.59KB 1.22KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 8.87KB 3.64KB
i18n (index.js) 5.24KB 2.27KB
i18n (pickLocalized.js) 9.86KB 3.95KB
i18n (provider.js) 39.35KB 12.88KB
i18n (translateFn.js) 0.20KB 0.18KB
i18n (useDisplayLocale.js) 3.52KB 1.76KB
i18n (useObjectLabel.js) 35.66KB 9.49KB
i18n (useSafeTranslation.js) 7.14KB 2.92KB
layout (index.js) 39.47KB 11.25KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.75KB
mobile (index.js) 1.99KB 0.87KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 6.62KB 2.45KB
mobile (useResponsive.js) 0.72KB 0.42KB
mobile (useSpecGesture.js) 5.52KB 2.10KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 13.86KB 5.00KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.52KB 2.26KB
permissions (discardProofCache.js) 1.04KB 0.55KB
permissions (evaluator.js) 8.33KB 3.07KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 4.83KB 2.27KB
plugin-ai (index.js) 16.04KB 3.92KB
plugin-calendar (index.js) 53.17KB 15.46KB
plugin-charts (index.js) 84.26KB 23.05KB
plugin-chatbot (index.js) 198.22KB 46.97KB
plugin-dashboard (index.js) 143.54KB 38.79KB
plugin-designer (index.js) 231.41KB 48.84KB
plugin-detail (index.js) 247.21KB 65.03KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 177.09KB 45.89KB
plugin-gantt (index.js) 179.16KB 45.06KB
plugin-grid (index.js) 235.92KB 64.87KB
plugin-kanban (index.js) 50.06KB 15.74KB
plugin-list (index.js) 116.72KB 29.10KB
plugin-map (index.js) 25.60KB 8.62KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 44.12KB 12.29KB
plugin-timeline (index.js) 38.80KB 11.71KB
plugin-tree (index.js) 14.51KB 5.15KB
plugin-view (index.js) 90.23KB 22.73KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.81KB 3.58KB
providers (index.js) 0.45KB 0.23KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.62KB 2.34KB
react (LazyPluginLoader.js) 4.47KB 1.63KB
react (SchemaRenderer.js) 120.63KB 39.56KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.50KB 2.06KB
react (schema-input.js) 4.31KB 2.07KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (body-dialect.js) 4.50KB 1.99KB
sdui-parser (codegen.js) 9.45KB 3.76KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 7.30KB 3.12KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (parse.js) 25.28KB 7.80KB
sdui-parser (provenance.js) 3.84KB 1.90KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 23.87KB 7.83KB
types (ai.js) 4.39KB 2.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 4.12KB 1.61KB
types (authoring-nodes.js) 0.20KB 0.19KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (cloud.js) 0.20KB 0.18KB
types (complex.js) 4.44KB 2.07KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (dashboard-widget-layout.js) 2.06KB 0.96KB
types (data-display.js) 3.75KB 1.85KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.85KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (expression.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 1.13KB 0.65KB
types (form.js) 0.20KB 0.18KB
types (http-inflight.js) 8.87KB 3.73KB
types (http-retry.js) 4.32KB 2.02KB
types (icon-key-migration.js) 4.26KB 1.63KB
types (index.js) 5.78KB 2.70KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 5.00KB 2.39KB
types (navigation.js) 0.20KB 0.18KB
types (node-slots.js) 7.18KB 2.34KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 2.52KB 1.31KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (select-option.js) 0.20KB 0.19KB
types (spec-report.js) 4.99KB 1.96KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (strict-authoring-face.js) 19.93KB 7.25KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 8.11KB 3.32KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

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

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 5, 2026 07:49
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 5, 2026
Merged via the queue into main with commit 531b26c Oct 5, 2026
45 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-11642-view-save-base branch October 5, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants