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
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