Repository navigation
perf(console): the first load stops downloading the Studio designer strings and the metadata form strings - #33682
Conversation
…the screens that read them The default Studio canvas moves to its own module and registers through lazyPage, which moves to services/lazyPage.tsx so every such registration shares one wrapper. The datasource page, the position list's two cells, the create-view dialog and the Pending changes sheet load on first draw. The studio namespace loader gets its own chunk group, so the eager i18n-runtime chunk stops carrying its static en edge. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5ousB2MKFUbJFc3Hwp
…rm strings Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5ousB2MKFUbJFc3Hwp
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5ousB2MKFUbJFc3Hwp
…ge prop type Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5ousB2MKFUbJFc3Hwp
|
domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8 席位核对Verdict: ACCEPT · head
|
Requested by Leehom · project thread
Fixes #33582
Clause-②: no
Metadata-protocol: none
Seat
domain:ui#2· os-project-manager · card threadsession_01FEkQ5ousB2MKFUbJFc3Hwp· claim 6889348795 and its two amendments维护者速读
pnpm --filter '@object-ui/console^...' build后在ui/apps/console跑CI=true pnpm exec vite build,读dist/eager-closure.json:eagerGzipBytes应为 2,058,464 左右,files里不再有i18n-ns-studio-en和metadata-form-i18n。What changes
Measured first on
origin/main3c0033f9with the instrument #33580 used (the console's ownvite.config.tsrun through Vite'sbuild()plus one read-only plugin that dumpsgetModuleInfo()and every chunk's module list; that build writes the sameeager-closure.jsonas a plain build): 107 eager chunks, 2,165,707 B gzip.i18n-ns-studio-en(64,296 B) andmetadata-form-i18n(11,363 B) are eager.The edges, read from that graph (eager importers only):
packages/i18n/src/namespaces/studio/index.tsmetadata-admin/i18n.ts; the module itself sits in the eageri18n-runtimegroup, with its staticenedgei18n-ns-studiochunk groupmetadata-admin/i18n.tsstudio-design/studio-canvas-preview.tsx,metadata-admin/datasource/DatasourceResourcePage.tsx,metadata-admin/PositionGrantCells.tsx,metadata-admin/previews/useDatasetCatalog.tsmetadata-admin/metadata-form-i18n.tspreview/changeKeyLabels.tsonly, throughpreview/DraftChangesPanel.tsx, mounted closed bypreview/DraftPreviewBar.tsx(inConsoleLayout)DraftChangesPanellazyThe cuts, each the #33580 shape:
services/lazyPage.tsx(new). perf(console): the first load stops downloading the Setup pages, the package form and the view config panel #33580'slazyPagemoves here frombuiltinComponents.tsxunchanged, so the three registration sites below share the one wrapper. It gains an optional third argument,fallback, so a list cell draws nothing while its module loads instead of the page-sized loading line.builtinComponents.tsximports it (and its fallback, still used by the two metadata-admin registrations).studio-design/studio-canvas-preview.tsxis imported by the package entry for its load-timeregisterStudioCanvasPreview('object', …)(it is in app-shell'ssideEffects). The default grid and everything only it reads (the@object-ui/reactrenderer hooks,useAuth, the designer strings) move verbatim tostudio-design/studio-object-records-canvas.tsx. The registry module keeps the registry, the contexts,navEntryListTargetandlistViewsOf, and exportsStudioObjectRecordsCanvasaslazyPage('studio canvas', () => import('./studio-object-records-canvas.js')). The name is unchanged and is the value registered, soStudioDesignSurface'sStudioCanvas === StudioObjectRecordsCanvascheck and the package entry's re-export need no edit.metadata-admin/datasource/register.tsregistersDatasourceResourcePagethroughlazyPage, typed with the registry'sListPageprops{ type: string }.services/builtinComponents.tsx: the position list'sPositionHolderCountCellandPositionGrantedSetsCellarelazyPage(…, null); the columnrenderfunctions are unchanged.views/ObjectView.tsx:CreateViewDialogislazy()with its mount insideSuspense fallback={null}, exactly asViewConfigPanel. Nothing else in the file changes.preview/DraftPreviewBar.tsx(seat amendment 2):DraftChangesPanelislazy()with its mount insideSuspense fallback={null}. The bar draws only in preview mode, so the sheet's chunk is requested only there.ui/apps/console/vite.config.ts: ani18n-ns-studiogroup fornamespaces/studio/index.tswithincludeDependenciesRecursively: false, beside the existingi18n-ns-studio-en/-zhgroups and for the reason the marketplace loader's group gives.enstays a static import of the namespace module, so it stays the synchronous fallback (app-shell: a published library that is 66% Console product surface — retire the 67 zero-reference exports now, decide the split, and fold the second i18n table into @object-ui/i18n #25922); the module and itsencatalogue leave the eager closure together.Result, final head
58e603fe, two builds of the same tree: 103 eager chunks, 2,058,464 B gzip both times (the console:build dist served in the live check read the same), −107,243 B (−5.0%) against main.i18n-ns-studio-enmetadata-form-i18ni18njson-schema-to-fieldsobject-fields-iouseDatasetCatalogobjectViewTitleSwitchersrcnewViewSpecThree small eager chunks appear:
usePendingDrafts(1,490),drillUrlFilters(1,454) andstudio-canvas-preview(919). They are modules that were already eager inside chunks that shrank, regrouped by rolldown; not new first-load bytes.pnpm check:eager-closureon that build: exit 0, aggregate 2010.2 KB / 2431.6 KB ceiling, headroom 421.4 KB = 0.61x the 695.0 KB regression.evaluateHeadroomSensitivity's predicate (headroom ≥ 1x) does not fire, so the gate asks for no re-pin;BASELINEis untouched.Changeset
.changeset/33582-console-eager-closure-studio-strings.md:@object-ui/consolepatch (app-shell is private; the console'sdistships it).Clause-②: no: nothing a package exports changes shape; app-shell is private, its entry still exportsregisterStudioCanvasPreviewwith the same signature, and no@object-ui/i18nkey is added or removed.Tests
studio-canvas-preview.test.tsx, "the registered object default loads the grid on first draw (objectstack#33582)": the registered default is the wrapper, not the grid module's own component, and drawn throughgetStudioCanvasPreview('object'), asStudioDesignSurfacedraws it, it loads and draws the grid with the schema the module's component renders. The file's existing grid-behaviour tests (objectui#11774, objectui#11823) now render the module's own component, imported at module scope (ui/AGENTS.md, lazy-boundary rule).scripts/ablation-replace.mjsonstudio-canvas-preview.tsx, the wrapper's loader.then((m) => m.StudioObjectRecordsCanvas)replaced by one that resolves a component drawing nothing): "drawn through the registry, it loads and draws the grid" red (1 failed, 1 passed, 15 skipped); restore: blob equal to HEAD88577d58c086,git diff HEADempty.console/__tests__/openPathObjectReaders-12811.test.tsclassifies every source file that readsuseMetadata().objects; the reader moved with the grid, so its row namesstudio-object-records-canvas.tsx(samekind: 'off', same reason).ui/under the lock: everyviews/studio-design/*.test.ts(x), every test importingObjectView, everypreview/*.test.tsxandCreateViewDialog*.test.tsx, and every test naming the changed modules (builtinComponents,PositionGrantCells, the datasource registration,register-builtins): 500 files, 3,982 tests. First run 498 files passed; the two red files were the canvas tests above (rendering the lazy name synchronously) and the census row. After the fix both files pass (20 / 20). The other 498 were not re-run after the test-only commit and the one-line type annotation.pnpm --filter @object-ui/app-shell run type-check(bothtscpasses): exit 0 on the final head. The first consolebuild:distcaughtTS2322on the datasource registration (an optionaltypeprop inferred); fixed by typing the wrapper with those props.react-refresh/only-export-componentsonlazyPage.tsxexporting a function beside a component).ineffective-dynamic-importledger ("41 ineffective dynamic imports, all pinned") anddeclared-lazy-views("11/12 … 1 eager, all pinned") print the same lines as on main, so none of the newimport()s is defeated by a static edge.Acceptance notes
metadata-admin/i18n.tsand saysmetadata-form-i18nrides the same edges. Measured on main, the four edges are exactly as named, butmetadata-form-i18nis not held by them: its only eager importer ispreview/changeKeyLabels.ts, reached throughpreview/DraftChangesPanel.tsx, whichpreview/DraftPreviewBar.tsxmounts closed. That edge also carried theobject-fields-iostraggler. The seat addedDraftPreviewBar.tsx(theDraftChangesPanelimport and mount only) to the claim before it was edited.CreateViewDialogis mounted closed with the list and its chunk carries the dataset catalogue, asViewConfigPaneldoes since perf(console): the first load stops downloading the Setup pages, the package form and the view config panel #33580. They stay off the dashboard and every non-list route (live check below).ObjectViewitself is still eager (AppContent's always-eager block): that is console first load: plugin-grid, plugin-form and RecordDetailView are still in the eager closure (split from #33293) #33581's, not touched here.AppContentandapps/console/src/register-plugins.tsare not edited.Verification
Live, the built console (
turbo run build:dist --filter=@objectstack/consoleat58e603fe) served by the showcase app (objectstack dev --ui --seed-admin --no-watch), a fresh browser context per route (cold cache, so every chunk the route needs is a request), Chromium via Playwright. Probe, screenshots androutes.json:/mnt/project-files/pm-orders/ui/33582-probe/in the project files.showcase_ops_dashboardi18n-ns-studio-en,i18n-ns-studio,metadata-form-i18n, the canvas, the datasource page, the position cells,CreateViewDialog,DraftChangesPanelCreateViewDialog,i18n-ns-studio(-en),metadata-form-i18non list mounti18n-ns-studio(-en)metadata/position)No route showed a raw
engine.*string key or a console error.Gates (local, head 58e603f)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 44 families. All run; 43 exit 0;pnpm check:dual-build-cjs-loadsexit 3 (PREREQUISITE NOT MET: nopackages/qa/scenarios/dist), NOT MEASURED, left to CI.--ranreconciliation: "44 derived famil(ies) accounted for — 43 run, 1 NOT-MEASURED". Per-family record:/mnt/project-files/pm-orders/ui/33582-gates-ran.txt. Outside the derived list:pnpm --dir ui check:eager-closureexit 0 (above).Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5ousB2MKFUbJFc3Hwp