Skip to content

feat(studio): the list-view panel switches between an object's list views, a drafted one included - #27988

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-o161ft
Oct 30, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-o161ft

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

维护者速读

  • 改了什么:Studio › 界面 › 列表视图面板,对象有两个以上列表视图时,面板顶部多一个「视图」选择器,按名称列出该对象的全部列表视图(已发布的,加上本包里还没发布的草稿视图,标「草稿」);选一个就在面板和画布上打开它的设置,改动自动保存到那个视图。
  • 为什么改:用「添加视图」建好的视图,作者一离开就在 Studio 里再也打不开了,只能靠导航项指名它。
  • 风险与回滚:只动 Studio 面板、宿主的切换守卫与两条 i18n;导航项不改,面板仍先打开导航项自己的视图;切换前先把未发出的修改发给原视图,发不出(被暂扣或被拒)就先问;整个 PR 回滚即恢复原状,无数据迁移。
  • 先看: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

  • A view picker in the list-view panel. When the open object has more than one list view, the panel shows a "View" picker above "Add view". It lists the object's list views by label (the panel's own title spelling: the item's label, else "OBJECT · Default view" or "OBJECT · KEY"). A view drafted in this package and not yet published carries a "Draft" mark.
  • Where the list comes from. Published views: the merged listViews map 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 existing MetadataClient with the drafts overlaid (withPreviewDrafts(true).list('view', { packageId }), keeping the _draft rows 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.
  • A pick opens that view in the same buffer. useObjectListViewDraft gains showView(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.
  • The switch goes through the pillar's guard. The Interfaces pillar's switchListView (the panel's onSwitchView) sends a pending edit first with the list-view autosave's own flush and 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) asks confirmDropUnsavedWork first; declined, the panel stays. "Back to …" now switches the same way (before, it dropped an edit still inside the debounce).
  • One view, no picker (the card's control, option "no picker" chosen): a one-entry picker offers nothing to pick, and "Add view" is the way to make a second view. An entry view that does not exist yet (a default view no edit has created) is still listed first, so the author can return to it.
  • i18n (en, zh, new keys only): 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.

  • the picker lists all three by label, only the drafted one marked "Draft", and opens on the nav entry's view;
  • picking the drafted view shows its settings, and an edit there saves to showcase_task.mine in the package draft, never to the entry's view;
  • a pending edit is sent to its own view at the switch (well inside the 1.5 s debounce), the other view opens, and nothing asks;
  • a held edit asks first: declined, the panel stays on that view with the held line and writes nothing; accepted, the other view opens and nothing is written;
  • control: an object with one list view shows no picker.
Ablations (one-time, not kept)

Both through node scripts/ablation-replace.mjs on the committed head, test files resolved from source:

  1. The host switch's flush (listViewSaving || (listViewDirty && !listViewHolds && flushListView()) reduced to listViewSaving): anchor 1 to 0, blob 0275069e to 309ac7ae. 1 failed, 4 passed: the pending-edit case (expected [] to deeply equal [ 'showcase_task.due' ]). Restored: blob equals HEAD, git diff HEAD empty.
  2. The draft read's _draft filter replaced by false: anchor 1 to 0, blob f46d63b6 to 86dd604b. 2 failed, 3 passed: the listing case ([ 'All tasks', 'Due dates' ]) and the drafted-view case. Restored: blob equals HEAD, git diff HEAD empty.

Acceptance notes

  • The drafted-view read is the overlaid list, not the draft headers. listDrafts serves 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.
  • Views drafted in another package are not listed: the read is scoped to this package, as every write here is. A published view of the object is listed whichever package published it.
  • The list is read when the object opens, after a publish, and after "Add view", not live: a view drafted meanwhile elsewhere (another tab, the copilot) appears once the leaf is opened again.
  • The confirm asks on the list-view buffer's dirty flag once the flush could not send, which is 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 run over the new file: 5 passed.
  • pnpm --dir ui exec vitest run over every ObjectListViewInspector.* and InterfacesPillar.* test, StudioDesignSurface.listView*, kanbanCardSelection, leafColumnSelection, studioCanvasLeaf, gridColumns, selectionLeafScope, copilotDraftBadge, heldWidgetLeave and rightSlot: 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.
  • ui i18n gates (check:i18n-keys, check:i18n-dead-keys, check:i18n-drift) and pnpm --dir ui check:new-line-citations: exit 0.
  • node scripts/pm/dispatch-gates.mjs --commands: 34 derived commands (check-sdui-manifest among them), each run, all exit 0, reconciled with --ran (34 run, 0 NOT-MEASURED, 0 UNRUN).

Generated by Claude Code

…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>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Oct 30, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe

席位核对

ACCEPT · head 74f38444c7d1a288b05cd02508206fdc48ae20a7 · 2026-10-30T07:06Z

  • Shape: draft → main, Fixes #27896. Clause-②: no and Metadata-protocol: none match the claim. The change is Studio-side only (@object-ui/app-shell, plus studio en/zh keys), so no contract review is owed.

  • Premise, measured: a list view other than the nav entry's own, including one just made with "Add view", could not be reached from the Studio panel. With two or more list views, the panel now shows a "View" picker listing them by label:

    • the merged published listViews;
    • this package's pending drafts of the object's views, marked Draft. They are read through the same client with withPreviewDrafts, so there is no new endpoint or client.

    A pick opens that view in the same buffer: the panel, canvas and autosave all follow it. The nav entry's view stays the default, and the nav entry is not rewritten.

  • Guard: the host switchListView flushes a pending edit and switches only once the buffer is clean. An edit that can't be sent (held or refused) asks first through confirmDropUnsavedWork. "Back to …" uses the same guard. The draft read failing lists the published views alone; the panel never fails on it.

  • Tests: StudioDesignSurface.listViewSwitch-27896 5/5 on the mounted pillar with the real autosave, and 32 neighbouring files (181 passed). Two ablations: reducing the flush to listViewSaving turns the pending-edit case red, and the draft filter → false turns 2 red. Each was restored to the HEAD blob.

  • Gates (check-runs on the head): 44 success, 11 skipped, 0 failure; mergeable_state clean. check-governed-merges --pr 27988: NOT governed, 545 changed lines.

  • Accepted deviations: the control chosen is "one list view → no picker", since there is nothing to switch to and "Add view" makes the second. The PR line-2 link names the card thread.

  • Out of scope: chart view settings are Studio list-view panel: edit a chart view's dataset binding (dataset, measures, dimensions) #27933.

  • Landing: non-governed, all checks green, mergeable_state clean ⇒ the seat lands it (pr_ready + automerge_enable).


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio list-view inspector: switch between an object's list views inside the panel, so a view made with Add view can be reopened

1 participant