Repository navigation
fix(app-shell): Studio's app designer canvas shows a locale-map nav label and renames only the current locale's entry (objectui#11128) - #11146
Conversation
…abel and renames only the current locale's entry AppNavCanvas read a nav item's `label` only as a string. A locale-map label (`I18nLabel`) now resolves in the designer locale through the spec's `resolveI18nLabel`; an inline rename of a map writes the designer locale's entry (exact tag, else bare language, else a new exact-tag entry) and keeps every other entry; a plain string renames as before. The truly-absent fallback reads the new `engine.appNav.item` catalogue row (en unchanged, zh added). Claude-Session: https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec Co-authored-by: Claude <noreply@anthropic.com>
|
changeset-claim-re-read
|
✅ Console Performance Budget
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
Size Limits
|
Contract reviewServed-tier: Inputs: card objectui#11128 (body and all 4 comments: triage ① Derived judgmentsDiff: 4 files, +215 −19. a. Display, b. Locale threaded as a prop; the hook out of c. d. Rename,
e. f. Catalogue row g. Pins — present and live. New file, 7 tests, each rendering h. Public surface — none moves. ② Semver level
③ Boundary flagsa. Open question: in the English designer, a map with no English entry gains b. Deviations.
c. Out-of-scope finding, d. Check-runs on the head ( e. Serial. objectui#10862 slice 4 (PR objectui#11134) merged before this branch was cut (claim: read at Implemented-by: VERDICT: PASS Generated by Claude Code |
Fixes #11128
Clause-②: no
What changed
packages/app-shell/src/views/metadata-admin/previews/AppNavCanvas.tsx, the design-mode nav editor used by the app preview and by the Studio app pillar. The spec types a nav item'slabelasI18nLabel: a plain string or an inline locale map.navLabelnow resolves the label in the designer locale through the spec'sresolveI18nLabel(the resolverAppPreviewalready uses). A map-labelled entry no longer reads as the positional "Item 1" while the preview's landing line beside it shows the resolved text.renamedLabelhelper keeps a plain string (or an absent label) as a plain string, as before. For a map it writes only the designer locale's entry and keeps every other entry. The entry written is the oneresolveI18nLabelreads first for that locale: the exact tag, else its bare language. A map with neither gains an entry under the exact designer tag. An entry that the resolver only reached as another language's fallback (default,enunderzh-CN, a sibling region such aszh-TW) is left as it was.engine.appNav.item, through the sametFormatand locale. The en valueItem {n}renders byte-equal to the old text; zh is导航项 {n}.useMetadataLocale()into the card tree as a prop. The card's draft effect now keys on the resolved label string instead of the item object.packages/app-shell/src/views/metadata-admin/i18n.ts: the oneengine.appNav.itemrow in the en and zh tables..changeset/11128-app-nav-canvas-label-maps.md:'@object-ui/app-shell': patch.Pins
New file
previews/AppNavCanvas.labelMaps-11128.test.tsx, 7 tests. Each one rendersAppPreviewin design mode inside anI18nProvider, with the previewlocaleset to match:Accountsunder en and客户under zh, with no positional fallback and no[object Object];engine.appNav.itemrow, which differs from the en row;{ en: 'Accounts', 'zh-CN': '客户账户' }, soensurvives;enentry the card read,{ en: 'Customers', 'zh-CN': '客户' }, with no seconden-USkey;zh-CN), anddefault,enandzh-TWare kept;Verification (final commit
9d2fb10d8)pnpm exec vitest run --maxWorkers=2 packages/app-shell/src/views/metadata-admin/previews/ packages/app-shell/src/views/metadata-admin/studio-locale.i18n.test.tsx packages/app-shell/src/views/studio-design/:Test Files 151 passed (151),Tests 1481 passed (1481).pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build(exit 0). Thenpnpm --filter @object-ui/app-shell type-check --listFilesrantsc --noEmit && tsc -p tsconfig.test.json --listFiles, exit 0, and the test project's file list includes the new pin file.pnpm exec eslinton the three changed source files: 3 files, 0 errors, 2 warnings. Both warnings are already there at base9fd6c2c6f, on the same statements with the same rules (no-explicit-anyon the draft read,set-state-in-effecton the draft reset). The eslint config has no type-aware linting (noprojectServiceorparserOptions.project) and no cross-file plugin, so this diff cannot move a verdict on an untouched file.node scripts/check-changeset-presence.mjs,node scripts/check-control-bytes.mjs,pnpm check:new-line-citations(0 new citations),pnpm check:i18n-designer-parity("every shared row carries the same placeholders"),pnpm check:i18n-drift(0 en values changed, 1 designer key added),pnpm check:i18n-keys,pnpm check:i18n-dead-keys(the new key is not listed).node scripts/check-governed-queue-guard.mjs --testover the four changed paths reports NOT GOVERNED.Ablations. These were one-shot, run after the fix was committed. Restore was proved each time by the file's blob equalling the HEAD blob and by
git diff HEADbeing empty. Mutations 2 and 3 went through objectstack'sscripts/ablation-replace.mjs, and each anchor hit exactly once.AppNavCanvas.tsxreverted whole to base9fd6c2c6f:6 failed | 1 passed (7). Only the plain-string control stays green.label: nextLabel, with the display fix kept:3 failed | 4 passed (7). Each of the three map-rename pins receives a plain string.1 failed | 6 passed (7). The en pin receives{ en: 'Accounts', 'en-US': 'Customers', 'zh-CN': '客户' }.Acceptance notes
StudioNavItemInspector(packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx) is the Studio app pillar's nav-item inspector beside this canvas. It reads the label asString(node.label ?? node.title ?? node.name ?? ''). I ran a probe that was not committed and was deleted afterwards: it rendered the inspector withlabel: { en: 'Accounts', 'zh-CN': '客户' }. The Label input showed"[object Object]", and one keystroke wrote the plain string"Customers"over the whole map. So the inspector can still delete map text that this canvas now keeps. It is in the same family as this card, but it is not on this card's file surface.en-USorzh-CN(useMetadataLocale), noten. That is why the rename matches the exact tag, then the bare language: a{ en, zh-CN }map renamed in the English designer updateseninstead of gaining anen-USkey. The one remaining choice is which key a gained entry uses in the English designer. This PR usesen-US, the designer's own tag. It is raised with the seat as a question and does not block this PR.{n}, thetFormatconvention this table uses (as inengine.inspector.widget.untitledN). The carrier note's example spellingItem {{n}}would renderItem {1}throughtFormat.The work was done in session
https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec(domain:uiseat 2's dispatched dev, branchclaude/issue-11128-app-nav-canvas-labels).Generated by Claude Code