Repository navigation
perf(app-shell): the in-app sidebar, the palette and recent rows name their items by name instead of loading whole metadata lists - #29413
Merged
Conversation
… name Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUpJJCdztFcegijAq7
…by name Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUpJJCdztFcegijAq7
… name Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUpJJCdztFcegijAq7
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUpJJCdztFcegijAq7
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUpJJCdztFcegijAq7
Contributor
Author
|
domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m 席位核对 · ACCEPT · 2026-11-02T14:40ZHead-sha:
|
Merged
9 tasks done
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 Steedos · project thread
Fixes #29235
Clause-②: no
Metadata-protocol: none
Claim: 6575822841 · amendment: 6576916626
维护者速读
ui/packages/app-shell/src/hooks/useObjectPresence.ts(新的useReadItemsByName)、ui/packages/app-shell/src/hooks/useNavTargetLabel.ts(仪表盘按名读)、ui/packages/app-shell/src/chrome/CommandPalette.tsx(面板取名改 byName)。meta/object:不再有不带名字的GET /api/v1/meta/object;侧边栏显示的名字与改前一致。What changes
Two label readers still downloaded a whole metadata list to name one row. Measured with CDP initiator stacks on a production Console (app-crm):
UnifiedSidebar(the in-app sidebar): an entry with no label of its ownuseNavTargetLabel()readmetadata.objects: the whole object registry and the/meta/viewlistuseNavTargetLabel({ byName: true }): the entry's object by name (the app bundle answers it, no request); a dashboard entry the bundle does not hold, by nameCommandPalette(mounted closed in every app; it names each navigation entry on every render to build its lists)useNavTargetLabel(), the same whole-list read, hidden behind the sidebar's by the provider cacheuseNavTargetLabel(RECENT_ROW_LABELS), the{ byName: true }constant the palette's recent rows already useuseRecentItemLabel: a recent dashboard rowmetadata.dashboards(throughuseNavTargetLabel'sbundledFirstfallback)useRecentItemLabel: a recent page row / report rowmetadata.pages(behindbundledFirst) /metadata.reportsuseReadItemsByName(inhooks/useObjectPresence.ts, besidereadObjectsByName) is the one helper for the non-object types. It asks through the provider's existing by-name read (getItem), so no provider or package export is added (@object-ui/app-shellis private). While nothing has loaded the type's list, each name is asked once and the reader re-renders as it lands. Once the list is loaded or loading, it reads the list and asks nothing. A hand-rolled context with no status or nogetItemreads its list, as before. A name that answered an item is asked again after the provider's value changes (the provider's by-name cache answers it without a request, unless an invalidation dropped it, so a rename shows). A name that answered nothing is not asked again while the reader is mounted.useNavTargetLabel({ byName: true })now also reads a dashboard target the bundle does not hold by name. The other callers (Studio, search page, inspectors,nav:menu) are unchanged.views/nav-menu-renderer.tsxis thenav:menupage block, not the in-app sidebar, so it is untouched.Tests
layout/__tests__/UnifiedSidebar.labelReadsByName-29235.test.tsx: the real sidebar over the realMetadataProviderand a recording adapter. Unlabelled object and dashboard entries readobject/NAMEanddashboard/NAME, never theobject,viewordashboardlist. Labels pinned in en and zh-CN (inline locale maps).chrome/CommandPalette.navLabelReadsByName-29235.test.tsx: the palette closed inside an app reads each entry's object by name and no list; opened, the entries show their objects' labels.hooks/__tests__/useRecentItemLabel.readsByName-29235.test.tsx: dashboard, page and report rows ask their own item, never the list. Labels pinned in en, and in zh-CN through an inline locale map and a translation-bundle key. The machine name shows until the item lands, and for an item the server does not have (asked once). CONTROL: with the lists loaded, the rows read them and ask no item.Acceptance notes
chrome/CommandPalette.tsx, at the:239hook call only. The production re-measure showed it was the reader left in-app once the sidebar asked by name.useNavMemberGatesreads its names-only scope with views, which reads the whole/meta/viewlist (7,014 B on app-crm). Outside an app, 租户首页为一个关着的命令面板读整个对象注册表(HotCRM 约 875 KB 原始 / 129 KB gz):HomeLayout 挂载时就把 useMetadata().objects 交给面板(cloud#2914 子卡 OU-1) #29121 already asks it withviews: false.AppContent: a package-less app has no object scope (appObjectScope.ts). So the in-app saving shows on its page routes, and on every route of a packaged app with unlabelled entries./meta/pagelist (AppContent's page scope, prefer-local).openPathObjectReaders-12811's row foruseNavTargetLabel.tsstill reads "off" with a reason naming Home; the census stays green, and its prose is not updated here (outside the claim's surface).Verification
Production Console, app-crm (
objectstack dev --fresh), before (baseb1779200) and after (headdb585d60; later commits only move the by-name reader's asked set into a ref and merge main)Setup: an app
ops_appsaved throughPUT /api/v1/meta/app/ops_appwith three unlabelled entries (crm_account,crm_contact,pipeline_dashboard). Recent rows come from visiting a dashboard and a page. Playwright logs in, reloads each page with the cache disabled, and logs every/api/request with its CDP initiator stack.In-app page route
/apps/ops_app/page/crm_welcome, en:GET /api/v1/meta/object(551,834 B) and/meta/view(7,014 B). The initiator isget objectsfrom theuseNavTargetLabelchunk, called fromui-layout'sNavigationRenderer.GET /api/v1/meta/objectwithout a name.crm_accountandcrm_contactare answered by the app bundle, with no request.CommandPalette'snavLabel, which led to the claim amendment.Home
/home, with a recent dashboard row and a recent page row, en:GET /api/v1/meta/dashboard(5,596 B) and/meta/page(15,463 B).GET /api/v1/meta/dashboard/pipeline_dashboard(3,054 B) and/meta/page/crm_welcome(1,044 B).The text shown is identical before and after:
Account,Contact,Pipeline Dashboard.客户,联系人,销售漏斗.CRM Welcome,Pipeline Dashboard.欢迎页,销售漏斗仪表盘.Ablations (each through
scripts/ablation-replace.mjs, restored withgit diff HEADempty){ byName: true }removed. Both sidebar cases red.metadata.dashboardsagain. Both sidebar cases and three recents cases red.metadata.pages. Three recents cases red.metadata.reports. Three recents cases red.navLabelresolver withoutbyName. Both palette cases red.Local runs
useNavTargetLabel,useRecentItemLabel,UnifiedSidebar,useObjectPresence,readObjectsByName,HomePage,RecentApps,CommandPalette,BuilderLanding,ConsoleLayout,HomeRail), ata3eaa1ecunderos-verify-lock,--maxWorkers=2, four batches: 220 files and 1,797 tests passed. After merging main (fix(app-shell): a package's non-first app opens itself from the avatar menu, palette, switcher, Home tiles and report index #29327 editsCommandPalette.tsx), the 77CommandPaletteand new-test files passed again atfa2a8da5(642 tests). CI's Test UI runs the rest of app-shell.turbo run type-check --filter=@object-ui/app-shell: 65/65 tasks.eslint --no-inline-configon the changed files: 0 errors. The three hooks have no warnings.dispatch-gates --commands): 34 commands, all exit 0 atfa2a8da5, reconciled with--ran(34 derived, 34 run, 0 NOT-MEASURED). The head3dcde8cdonly merges main again (no touched file moved); on it the 35 sidebar, palette and new-test files (165 tests), app-shell type-check (65/65),check-sdui-manifestandcheck-changeset-no-majorpass.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jUpJJCdztFcegijAq7