Repository navigation
perf(app-shell): an object list loads the package ask, the view settings panel and the create-view dialog only when opened - #38429
Merged
Conversation
…ngs panel and the create-view dialog only when opened The list route imported the package ask and the designer strings statically and drew the ask, the view config panel and the create-view dialog closed on every list, so ~183 KB (brotli) of authoring code was fetched before the list's first screen. Each now loads on its first opening and stays mounted after; a refused view create loads its words with the refusal. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxzGFPvShbd2qnkdEv
Contributor
Author
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-29T01:50Z · zone
|
This was referenced Nov 29, 2026
Merged
Nenzyz
pushed a commit
to Nenzyz/objectstack
that referenced
this pull request
Dec 1, 2026
…nly when a form opens (objectstack-ai#38486) <!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoLA64Pdo43CcX7aDR1Nooow)_ Part of objectstack-ai#37444. This is the second cut, after objectstack-ai#38429: the object list page stops loading the form package before its first screen. What this PR build measured (Verification below, 20 vs 20 against main `4d07ddbf`): the list fetches about 45 KB gzip less form code before its first screen (225 → 224 scripts), and its LCP moved −46.5 ms at p 0.22, not a significant change and still above 2500 ms. So the card stays open after this PR, for candidate B. Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户打开对象列表页时,首屏前少下载约 45 KB 的表单代码;这次构建测得列表页首屏时间没有显著变化(−46.5 毫秒,p 0.22),仍未进 2.5 秒。页面上看到和保存的内容都不变。 - 属于「控制台首屏 2.5 秒内打开」专题,这是列表页的第二刀。 - 出错时,列表页上第一次点「新建」或编辑记录会多等一下,或者表单打不开;撤回这个 PR 即可恢复。 - 无。 ## What changes An object list fetched the whole of `@object-ui/plugin-form` (45.6 KB gzip, measured on `1afd9c13`) before its first screen, though it draws a form only when someone creates or edits a record. Two things did this: 1. `plugin-view`'s `ObjectView` imported `ObjectForm` statically. The form is drawn only inside the drawer or modal, whose content mounts when it opens. 2. The console's `AppContent` drew a closed `LazyModalForm` on every object page: `formObjectDef` is set whenever an object is open, and a lazy component that is drawn fetches its chunk even closed. Making only the first import lazy left the chunk on the list route (seen in a probe; it was still fetched at about 2.0 s). Now: - `plugin-view/src/ObjectView.tsx`: `ObjectForm` is `React.lazy`, and both form sites (drawer and modal) sit in a `Suspense` with a `null` fallback. - `app-shell/src/console/AppContent.tsx`: the record-form modal mounts the first render its open state is true (`useOpenedOnce(recordFormShown)`), and stays mounted after that, so it closes the way it did before. It is never drawn closed first. - `useOpenedOnce` moves from `app-shell/src/views/ObjectView.tsx` (where objectstack-ai#38429 added it) to `app-shell/src/hooks/useOpenedOnce.ts`, package-internal, shared by both files. It is not exported from the package. No exported shape, prop or option changes; no spec or metadata change. ## Tests - New `plugin-view/src/__tests__/ObjectView.formLoadsOnOpen-37444.test.tsx`: a counted `vi.mock` factory for `@object-ui/plugin-form`. Importing and drawing a drawer-layout list evaluates no form module; clicking New loads it once and draws the form in `create` mode. - New `app-shell/src/console/__tests__/AppContent.recordFormMountsOnOpen-37444.test.tsx`: an object page with no form open loads no form module and draws no modal; `?form=new` loads it once and its first render is open. - `ObjectView.tableEditable-10976`, `ObjectView.namedViewInlineEdit-10885` and `ObjectView.test.tsx` (navigation drawer default) read the form on the click's tick; they now wait for it, since it loads on first open. <details><summary>Pin ablation</summary> Committed first, then `scripts/ablation-replace.mjs`, one half at a time: 1. `AppContent.tsx`: the anchor `{formObjectDef && recordFormMounted && (` replaced with `{formObjectDef && (`. Both AppContent cases red: case 1 drew a modal and `loads.form` was 1 (expected 0); case 2 failed on its starting count. Restored: blob equals HEAD. 2. `plugin-view/src/ObjectView.tsx`: the lazy `ObjectForm` const replaced with the static `import { ObjectForm } from '@object-ui/plugin-form';`. The plugin-view case red (`expected 1 to be +0`). Restored: blob equals HEAD, `git diff HEAD` empty. </details> ## Acceptance notes - Read first: `AppContent.tsx` (the `recordFormMounted` gate next to `useRecordFormOpensOverDrawers`), then `plugin-view/src/ObjectView.tsx` (the lazy const and the two `Suspense` sites). - Two-minute check: on a list page, open the network panel and load the list: no `plugin-form` chunk. Click New: the form opens after one chunk fetch. Close it and open it again: no new fetch. - A user sees a short wait the first time a create or edit form opens on a page. ## Verification LCP reading on this PR's build (report on objectstack-ai#37444, comment 7251766050), Lighthouse 13.6.0 desktop, 20 vs 20 per page against main at the merge base `4d07ddbf`: | page | main | PR | delta | p | |:--|--:|--:|--:|--:| | home | 2160 | 2184.5 | +24.5 | 0.41 | | object list | 2631 | 2584.5 | −46.5 | 0.22 | | record | 2533.5 | 2457 | −76.5 | 0.0007 | The list fetches no `plugin-form` chunk: 225 → 224 scripts, −45.4 KB gzip. It does not clear 2500 on this reading, so the card stays open. A same-session control read main `1afd9c13` at 2681.5. The same build read 2521.5 in the second-cut reading, so the box level moved about 160 ms between sessions. The record delta is unexplained: bytes, script count and the `plugin-form` request time match on both builds. <details><summary>Gates</summary> Derived gates (`dispatch-gates.mjs --ran`): 38 derived, 38 run, 38 exit 0, 0 NOT-MEASURED, on `6a6dc4b9`. Two needed a fix first, on the new AppContent pin: `check:test-source-alias` (a module-top `import '@objectstack/lint'`) and `check-vi-mock-inherit` (both counted `plugin-form` factories now spread `importOriginal`); the pins and both ablations were re-run after it. `vitest run scripts/`: 172 files passed. Affected suite under the verify lock: 251 files / 2286 tests passed. eslint on the changed files: 0 errors. Overlap check against `origin/main` `430bbbf1`: merges cleanly. Changed lines: +290/−21 (311). </details> ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; eslint on the changed files: 0 errors. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: n/a. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibxzGFPvShbd2qnkdEv <!-- signed: repo:objectstack#3 · os-tesla · session_01L9qibxzGFPvShbd2qnkdEv --> Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz
pushed a commit
to Nenzyz/objectstack
that referenced
this pull request
Dec 1, 2026
… at boot (objectstack-ai#38682) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ844kETyNGBBt9atKc1Snfzd)_ Part of objectstack-ai#37444 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:看不到界面变化。打开 Console 的每一页时,首屏不再提前下载 Studio 的翻译包(约 82 KiB);表单列表的「开/关」文字在打开 Studio 列表时才加载。 - 为什么做:objectstack-ai#38484 之后,表单列表的列定义在启动时就静态引入了 Studio 翻译模块,把 objectstack-ai#38429 已经挪出首屏的翻译包又带了回来(objectstack-ai#37444 的固定对照测量发现,评论 7264938326)。 - 效果:首屏少下载 82 KiB;但复测对象列表 LCP 只快 15 ms(p 0.54,误差内),仍比 2500 ms 超约 68 ms。所以本 PR 修掉回退,不关卡;列表剩下的差距在渲染 CPU,归 objectstack-ai#37575。 - 出错会怎样:最坏是表单列表「开/关」一栏首次显示时晚一帧;可直接撤回。 - 要你做的:无。发布冻结期保持 draft。 ## What changes - `ui/packages/app-shell/src/views/studio-design/publicForm/formListColumns.tsx` no longer imports `../../metadata-admin/i18n.js` statically. The form list's On cell loads the designer string table with `React.lazy` on first draw; the Studio list has already loaded that module by then, so it resolves at once. - `services/builtinComponents.tsx` still registers `FORM_LIST_COLUMNS` at boot, but the boot closure no longer reaches the metadata-admin i18n module, so the built Console's `index.html` no longer preloads `i18n-ns-studio-en` (70.8 KiB) or the metadata-admin i18n chunk (10.3 KiB): 134 modulepreloads, list 229 → 225 scripts before LCP. - Pin: `ui/packages/app-shell/src/services/__tests__/builtinComponents.formListWordsOffBoot-37444.test.tsx` — (1) the walk sees the edge it guards (ResourceListPage reaches the designer table); (2) `builtinComponents.tsx` reaches no designer table through static imports; (3) the On cell renders "On"/"Off" after the lazy load. - Changeset: patch, `@object-ui/app-shell`. ## Tests Head `e1bbe0b8` (reworded to `394a0455` for the commit-trailer check; identical tree): - Under the lock: the new pin plus `studio-design/publicForm` and `firstScreenStudioCatalogue-37444`: 4 files, 54/54 passed; `ui scripts/__tests__/check-i18n-call-site-keys.test.ts`: 152/152 passed. - Ablation (`scripts/ablation-replace.mjs`): a static `import { t } from '../../metadata-admin/i18n.js'` put back into `formListColumns.tsx` turns case 2 red (1 failed, 2 passed); restored, blob == HEAD. - `pnpm --filter @object-ui/app-shell type-check`: exit 0. `pnpm console:build`: exit 0; `index.html` has no `i18n-ns-studio` or metadata-admin i18n chunk. - Browser, branch production build: `/_console/studio/~all/metadata/form` shows "On" for `showcase_inquiry.contact` and `showcase_inquiry.feedback`. ## Measurement (production build, HTTP/2, Lighthouse desktop, ruling conditions) One session, arms branch / base `f5da514b` / control `1afd9c13`, 20 runs per arm per page; control list 2535.1 ms, inside the pre-set band, so scored; no block discarded. | page | branch | base | branch − base | |:--|--:|--:|--:| | object list | 2568.4 | 2583.4 | −15.0 ms (p 0.54, 95% CI −60…+71) | | record | 2446.9 | 2434.3 | +12.7 ms (p 0.81) | The cut restores the bytes but has no measurable LCP effect; the done-when stays unmet on the list. Readings and instrument: project folder `card-37444/a-measure/recut/`; report comment 7266607998 on objectstack-ai#37444. ## Verification - `dispatch-gates --commands`: 38 derived, 38 run, all exit 0 (`ui scripts/` vitest re-run with `--maxWorkers=2` after an OOM kill while measurement servers were up: 172 passed, 2 skipped). `--ran`: 0 NOT-MEASURED. - `overlap-check.mjs`: clean against origin/main; `git merge-tree` against origin/main at push: clean. - CI check-runs: read on this PR. Files to read first: `formListColumns.tsx` (the lazy On cell). Two-minute check: open Studio → Forms list; the On column reads "On"/"Off". 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbamiNxp7695qyaEYsH <!-- signed: repo:objectstack#2 · os-warren · session_01JQwxbamiNxp7695qyaEYsH --> --------- Co-authored-by: Claude <noreply@anthropic.com>
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 Tesla · project thread
Part of #37444. This is the first cut: the object list page stops loading authoring code before its first screen. The card stays open, because this cut alone is not expected to bring the list page under 2.5 s; a second cut waits for this PR's reading and a claim amendment.
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The object list route (
ObjectView) pulled about 69 chunks (~183 KB brotli, measured onff69bcab) of authoring code before its first screen:objectViewViewCrud.tsxandobjectViewViewSharing.tsimportedmetadata-admin/PackageCreateAskandmetadata-admin/i18nstatically (since feat(app-shell): a create with no named package asks to pick or create one #38204).usePackageCreateAskdrew a closedPackageCreateAskDialogon every list, and that dialog imports the package page's create dialog,PackageFormDialog,SchemaFormand the Studio catalogue.ViewConfigPanelandCreateViewDialogareReact.lazy, but were rendered closed on every list, so their chunks were fetched on every list load too.Now:
useDeferredPackageCreateAsk(inobjectViewViewCrud.tsx) keeps the sameask(request) => Promise<string | null>contract. It mounts a lazyPackageCreateAskDialogon the first ask and keeps it mounted afterwards, so it closes the way it did before. A newer ask still resolves the older one withnull, and unmount still resolves a pending ask withnull.reportViewNotSaved(err, locale)still answers synchronously whether the error was a runtime-create refusal. The refusal text, the designer locale mapping and the Studio catalogue load on the refusal, and the toast shows once they arrive. A cancelled ask still shows nothing.useObjectTranslation()instead ofuseMetadataLocale();designerLocaleOfmaps it at refusal time.ObjectView.tsxmountsViewConfigPanelandCreateViewDialogthe first time each opens (useOpenedOnce), and keeps them mounted after that.No exported shape changes, no spec or metadata change.
Tests
objectViewListRoute.deferredAuthoring-37444.test.tsxpins the load order with countedvi.mockfactories: importing./ObjectViewevaluates none ofPackageCreateAsk,PackagesPage,SchemaForm,metadata-admin/i18n,ViewConfigPanel,CreateViewDialog; the ask loads its dialog on the first ask, answers it and stays mounted closed; a refused create toasts once its words load, a cancelled one never toasts.ObjectView.readOnlyPackageViewSaves-35974.test.tsxandObjectView.viewConfigSaveWiring-10210.test.tsxread the panel's props; they now open the panel first, since a closed panel is no longer mounted. The personal-view case now asserts the closed panel is not mounted.Pin ablation
Committed first, then
scripts/ablation-replace.mjsonobjectViewViewCrud.tsx: the anchorimport type { PackageAskRequest } from './metadata-admin/PackageCreateAsk.js';replaced with a value import ofPackageCreateAskDialog(void-used). Result: case 1 (packageAsk0 → 1) and case 2 red, case 3 green: 2 failed, 1 passed. Restored: blob equals HEAD,git diff HEADempty.What is not separately pinned: the
CreateViewDialogrender deferral inObjectView(its module-load count is pinned at import time only; no case opens the dialog). TheViewConfigPanelrender deferral is pinned by the 35974 personal-view case.Acceptance notes
objectViewViewCrud.tsx(useDeferredPackageCreateAsk: the resolve-older-ask and unmount paths), thenObjectView.tsx(useOpenedOnceand the two mount sites), thenobjectViewViewSharing.ts(the catch path).PackagesPage,SchemaFormorCreateViewDialogchunk. Click the view settings gear: the panel opens after one chunk fetch.all), not on the open view (unit-level evidence only).Verification
LCP on this PR's build (
bd4f2071) against main, by the card's method: production builds, HTTP/2 TLS front, Lighthouse 13.6.0 desktop preset, signed in, blocks main-1, pr-1, pr-2, main-2 of 5 runs per page. The record page got a reversed round on top. p is a two-sided permutation test on the median difference. Full runs: card comment 7248989586.On the list page, the scripts fetched before the first screen go from 274 to 225: 171.6 KB less gzip as served, or 188 KB less brotli by the dist's
.brfiles. Home and record fetch the same script count on both builds. The list is still 51 ms over 2500, so the card stays open for a second cut.Gates
node scripts/pm/dispatch-gates.mjs --commands: 38 derived, all 38 exit 0.--ran: 38 run, 0 NOT-MEASURED, 0 UNRUN.--tier: no path-derived mandate; 356 changed lines (under 3000).overlap-check: merges cleanly ontoorigin/main, VERDICT clean.cd ui && pnpm exec vitest runon 23 affected app-shell files: 265/265 passed.Human Minimum
packages/specholds no runtime logic. (not touched)main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibxzGFPvShbd2qnkdEv