Skip to content

perf(app-shell): an object list loads the package ask, the view settings panel and the create-view dialog only when opened - #38429

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-kz8j47
Nov 29, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-kz8j47

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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

维护者速读

  • 用户打开对象列表页时少下载约 180 KB 的编辑类代码,首屏更快;页面上看到和保存的内容都不变。
  • 属于「控制台首屏 2.5 秒内打开」专题,这是列表页的第一刀。
  • 出错时,第一次打开选包框、视图设置面板或新建视图框会多等一下,或者打不开;撤回这个 PR 即可恢复。
  • 无。

What changes

The object list route (ObjectView) pulled about 69 chunks (~183 KB brotli, measured on ff69bcab) of authoring code before its first screen:

  1. objectViewViewCrud.tsx and objectViewViewSharing.ts imported metadata-admin/PackageCreateAsk and metadata-admin/i18n statically (since feat(app-shell): a create with no named package asks to pick or create one #38204). usePackageCreateAsk drew a closed PackageCreateAskDialog on every list, and that dialog imports the package page's create dialog, PackageFormDialog, SchemaForm and the Studio catalogue.
  2. ViewConfigPanel and CreateViewDialog are React.lazy, but were rendered closed on every list, so their chunks were fetched on every list load too.

Now:

  • useDeferredPackageCreateAsk (in objectViewViewCrud.tsx) keeps the same ask(request) => Promise<string | null> contract. It mounts a lazy PackageCreateAskDialog on the first ask and keeps it mounted afterwards, so it closes the way it did before. A newer ask still resolves the older one with null, and unmount still resolves a pending ask with null.
  • 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.
  • Both hooks read the locale from useObjectTranslation() instead of useMetadataLocale(); designerLocaleOf maps it at refusal time.
  • ObjectView.tsx mounts ViewConfigPanel and CreateViewDialog the first time each opens (useOpenedOnce), and keeps them mounted after that.

No exported shape changes, no spec or metadata change.

Tests

  • New objectViewListRoute.deferredAuthoring-37444.test.tsx pins the load order with counted vi.mock factories: importing ./ObjectView evaluates none of PackageCreateAsk, 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.tsx and ObjectView.viewConfigSaveWiring-10210.test.tsx read 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.mjs on objectViewViewCrud.tsx: the anchor import type { PackageAskRequest } from './metadata-admin/PackageCreateAsk.js'; replaced with a value import of PackageCreateAskDialog (void-used). Result: case 1 (packageAsk 0 → 1) and case 2 red, case 3 green: 2 failed, 1 passed. Restored: blob equals HEAD, git diff HEAD empty.

What is not separately pinned: the CreateViewDialog render deferral in ObjectView (its module-load count is pinned at import time only; no case opens the dialog). The ViewConfigPanel render deferral is pinned by the 35974 personal-view case.

Acceptance notes

  • Read first: objectViewViewCrud.tsx (useDeferredPackageCreateAsk: the resolve-older-ask and unmount paths), then ObjectView.tsx (useOpenedOnce and the two mount sites), then objectViewViewSharing.ts (the catch path).
  • Two-minute check: on a list page, open the browser's network panel, load the list: no PackagesPage, SchemaForm or CreateViewDialog chunk. Click the view settings gear: the panel opens after one chunk fetch.
  • Found while testing, not changed here: the toolbar Settings path opens the config panel on the first grid view (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.

page main median (ms) PR median (ms) delta p
home (10 vs 10) 2080.5 2115.5 +35 0.33
object list (10 vs 10) 2647 2551 −96 0.03
record (20 vs 20) 2444.5 2478.5 +34 0.30

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 .br files. 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 onto origin/main, VERDICT clean.
  • cd ui && pnpm exec vitest run on 23 affected app-shell files: 265/265 passed.
  • eslint on the 6 changed source and test files: 0 errors.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; eslint on the changed files: 0 errors.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibxzGFPvShbd2qnkdEv

…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
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 29, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-29T01:50Z · zone o3-ux (seat card thread)
Head-sha: bd4f20712f125e57545bf16ae26fc9f1eab2d39f

  • L1-a ACCEPT 7249038590 at this head. No contract review owed: Clause-② no is verified (app-shell is private, and every lazily imported symbol was already exported at the merge base). Metadata-protocol none. Patch changesets for app-shell and console. The nit on CreateViewDialog's render-deferral pin is accepted. The toolbar Settings finding gets no card: it can't be reached from the console today (L1-a's reading).
  • Claim 7248103031. Dev report 7248989586.
  • Readings on the PR build by the card's method: list 2647 → 2551 ms (−96, p 0.03). Record +34 (p 0.30; the reversed round reads 0) and home +35 (p 0.33) are not significant. List-route eager scripts 274 → 225, −171.6 KB gzip. Part of #37444: the list is still 51 ms over 2.5 s, so the card stays open for a second cut under a claim amendment.
  • check-governed-merges.mjs --pr 38429: NOT governed. Size +327 / −29, 7 files.
  • K: 8 < 15.
  • Checks at this head: all success or expected skip; Check Changeset re-run success 01:49Z. mergeable_state clean.
  • Action: mark ready for review and enable auto-merge (queue).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 29, 2026 01:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit 1afd9c1 Nov 29, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-kz8j47 branch November 29, 2026 02:13
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants