Repository navigation
feat(studio): the list-view panel switches between an object's list views, a drafted one included - #27988
Conversation
…dio list-view panel The panel's view picker lists the object's list views by label, the published ones and this package's drafts, and a pick opens that view's settings in the same buffer. The switch sends a pending edit first, or asks before a held one is dropped. Claude-Session: https://claude.ai/code/session_01Utp6CavwqdDhGGbn4QX4Zq Co-authored-by: Claude <noreply@anthropic.com>
…d switch; add the changeset Claude-Session: https://claude.ai/code/session_01Utp6CavwqdDhGGbn4QX4Zq Co-authored-by: Claude <noreply@anthropic.com>
|
domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe 席位核对ACCEPT · head
Generated by Claude Code |
Requested by Bill · project thread
维护者速读
StudioDesignSurface.tsx里的switchListView与紧随的 effect(冲刷后再切、暂扣先问)、ObjectListViewInspector.tsx的listViewChoicesOf与草稿读取 effect、新测试文件。pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/StudioDesignSurface.listViewSwitch-27896.test.tsx,预期 5 passed。Fixes #27896
Clause-②: no
Metadata-protocol: none
What changes
listViewsmap the shell's metadata already holds, the same map the panel resolves the nav entry's view from. Drafted views: this package's pending drafts of the object's list views, read once per object, package and publish through the pillar's existingMetadataClientwith the drafts overlaid (withPreviewDrafts(true).list('view', { packageId }), keeping the_draftrows of this object), the read the Studio rail already uses for draft labels. A draft stands in for the published view of its name. "Add view" re-reads it, so a view made there is listed. A failed or refused read lists the published views alone. No new endpoint, client or metadata key.useObjectListViewDraftgainsshowView(viewId); the picked view replaces the one "Add view" created in the hook's single "shown instead of the entry's view" slot, stamped with the nav entry, so it expires when another leaf opens. The panel, the canvas and the autosave then address the picked view; an edit saves to its draft under its own name. The nav entry's view is still the one the panel opens with, and the nav entry is not changed.switchListView(the panel'sonSwitchView) sends a pending edit first with the list-view autosave's ownflushand switches once the buffer is clean, waiting out a save in flight, as the Data pillar's object rail does. An edit that cannot be sent (held for a missing required setting, or refused with the refusal on screen) asksconfirmDropUnsavedWorkfirst; declined, the panel stays. "Back to …" now switches the same way (before, it dropped an edit still inside the debounce).engine.studio.inspector.listView.switchView,engine.studio.inspector.listView.switchViewDraft.Tests
StudioDesignSurface.listViewSwitch-27896.test.tsx: the mounted Interfaces pillar, its real list-view autosave and the real panel; the client is a recorder. The object has a published default grid, a published calendar and a calendar only drafted in this package.showcase_task.minein the package draft, never to the entry's view;Ablations (one-time, not kept)
Both through
node scripts/ablation-replace.mjson the committed head, test files resolved from source:listViewSaving || (listViewDirty && !listViewHolds && flushListView())reduced tolistViewSaving): anchor 1 to 0, blob0275069eto309ac7ae. 1 failed, 4 passed: the pending-edit case (expected [] to deeply equal [ 'showcase_task.due' ]). Restored: blob equals HEAD,git diff HEADempty._draftfilter replaced byfalse: anchor 1 to 0, blobf46d63b6to86dd604b. 2 failed, 3 passed: the listing case ([ 'All tasks', 'Due dates' ]) and the drafted-view case. Restored: blob equals HEAD,git diff HEADempty.Acceptance notes
listDraftsserves names only (no object, no label), so listing a draft by label from it would cost one read per draft. The overlaid list is one read, through the same client the pillar already holds.heldUnsent's list-view half plus a refused save; the leaf's own held edit (leafHeld) belongs to another buffer that a view switch does not touch.Verification
Run on head
74f38444:pnpm --dir ui exec vitest runover the new file: 5 passed.pnpm --dir ui exec vitest runover everyObjectListViewInspector.*andInterfacesPillar.*test,StudioDesignSurface.listView*,kanbanCardSelection,leafColumnSelection,studioCanvasLeaf,gridColumns,selectionLeafScope,copilotDraftBadge,heldWidgetLeaveandrightSlot: 32 files, 181 passed.packages/i18n/src/__tests__/studio-namespace.test.ts: 18 passed.pnpm --filter @object-ui/app-shell --filter @object-ui/i18n run type-check: exit 0.uii18n gates (check:i18n-keys,check:i18n-dead-keys,check:i18n-drift) andpnpm --dir ui check:new-line-citations: exit 0.node scripts/pm/dispatch-gates.mjs --commands: 34 derived commands (check-sdui-manifestamong them), each run, all exit 0, reconciled with--ran(34 run, 0 NOT-MEASURED, 0 UNRUN).Generated by Claude Code