Repository navigation
fix(app-shell): show Studio nav entries in the menu's order, and let a canvas drag write order - #27039
Merged
Conversation
…a canvas drop write order The Interfaces rail and AppNavCanvas listed nav entries in array order while the running menu sorts each level by order. Both now list a level through inMenuOrder (the menu's byNavOrder rule), and a canvas drop writes the array in the new shown order plus the moved entry's order when its weight no longer falls between its new neighbours'. Claude-Session: https://claude.ai/code/session_01JQwxbWATiRKGB7bP2VvNAG Co-Authored-By: Claude <noreply@anthropic.com>
…one nav order Claude-Session: https://claude.ai/code/session_01JQwxbWATiRKGB7bP2VvNAG Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWATiRKGB7bP2VvNAG Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
席位核对ACCEPT · seat 席位意见:Studio「界面」左栏导航树和导航画布按运行时菜单的规则排列(
|
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 free
to 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.
Requested by Warren · project thread
Fixes #26979
Clause-②: no
Metadata-protocol: none
维护者速读
order排列,与运行时菜单一致;画布拖拽排序时必要时写入被拖条目的order。order排序,Studio 却按数组顺序显示,设置了order的条目在设计器和发布后的菜单里位置不同,拖拽也可能看不出效果。order的应用显示与拖拽结果不变;回滚即还原本 PR。AppNavCanvas.tsx的moveItem与inMenuOrder;StudioDesignSurface.tsx的NavTree;新测试块railNavOrder-26979。pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/StudioDesignSurface.railLabels.test.tsx -t railNavOrder,预期 4 个测试全部通过。What changes
NavTree) and the nav canvas (AppNavCanvas) list every level through one new helper,inMenuOrder(exported fromAppNavCanvas.tsx):orderascending, an absentorderas0, ties in authored order. That is the running menu's rule,byNavOrderin@object-ui/layout, which the sidebar applies at the top level and inside each group. Selection ids, renames and removals still address the authored array index.orderonly when its current weight no longer falls between its new neighbours'; it then takes its neighbour's weight and the stable sort keeps it where it was dropped. At most oneorderwrite per drop, and none for an app whose entries carry noorder.NavNode(navSurface.ts) and the canvas'sRawNavdeclare the spec'sorder?: number, type only.Why this shape (the card's two options, measured)
orderat every level, stably. A drag that only rewroteorder(shape b) cannot fix entries whoseorderwas written by the API or the inspector before any drag: the rail and canvas would still list array order. So both lists sort (shape a), and then a drag has to writeorderor it does nothing visible. Normalising the array to the shown order lets one neighbour-weight write place the entry, which is the fewestorderwrites that keeps the builder equal to the menu.byNavOrderis not imported:navOrder.tsis internal to@object-ui/layoutand publishing it would widen that package's entry point. Per the seat's claim amendment on the card, Studio states the same rule locally and a test rendersNavigationRendererbeside the rail and the canvas over the same entries, so the two rules cannot drift without a red test.AppNavCanvasis shared with Setup's app editor (AppPreview.tsx), which mounts the same component: the sorted listing and the drop behaviour are the same there.Tests
StudioDesignSurface.railNavOrder-26979inStudioDesignSurface.railLabels.test.tsxrenders the realInterfacesPillarrail,AppNavCanvasandNavigationRenderer:order[3, 1, 2] plus a group whose children carry [2, 1] read in one order on all three;order; every other entry is the same object);orderkeep array order, and a drag among them writes noorder.Ablations (each self-restoring through
scripts/ablation-replace.mjs, blob equal to HEAD after restore):inMenuOrderstops sortingorderwrite removedNavTreelists array orderThe first attempt at the sort ablation was refused by the tool (its replacement text already occurred in the file), so it did not run; it was rerun with a distinct replacement.
Acceptance notes
firstLeafin the load effect), which can now differ from the rail's first row whenorderreorders the top. Observation only.@object-ui/app-shell, which isprivate: true.Verification
All local readings on head
42f2d1b4unless noted. Exit codes captured before any pipe.Derived gate families (24): all exit 0, reconciled with dispatch-gates --ran
node scripts/pm/dispatch-gates.mjs --commandsderived 24 families for this diff; each ran on42f2d1b4and exited 0.--rananswers: "24 derived famil(ies) accounted for — 24 run, 0 NOT-MEASURED". The set includesnode scripts/check-sdui-manifest.mjs(and its--self-test),node scripts/check-comment-mask-corpus.mjs,pnpm --dir ui exec vitest run scripts/,pnpm check:cross-package-test-inputs,pnpm check:test-source-alias,pnpm check:type-check-coverage,pnpm check:type-check-debtandpnpm check:nul-bytes.Package tests and extra families (on 54fb22e; the later commit adds one comment and one lint directive)
pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/: Test Files 243 passed (243), Tests 1761 passed (1761).pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/previews/ packages/app-shell/src/views/metadata-admin/studio-locale.i18n.test.tsx: Test Files 148 passed (148), Tests 1678 passed (1678). Covers Setup'sAppPreviewmount of the canvas.pnpm --filter @object-ui/app-shell type-check: exit 0.pnpm --dir ui run check:spec-symbols: exit 0.pnpm --dir ui run check:new-line-citations: 0 new citations, exit 0.42f2d1b4the new export adds no warning (it carries the same directive asnavPayloadOf).42f2d1b4:StudioDesignSurface.railLabels.test.tsxwhole file, Tests 60 passed (60).Not run locally, CI-owned: the repo-wide
pnpm lint,test:repo, and the full UI suite.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbWATiRKGB7bP2VvNAG
Generated by Claude Code