Skip to content

perf(console): start an object list's saved-view read with the route, not after its lazy modules - #35579

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-35535-view-prefetch
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-35535-view-prefetch

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Part of #35535

This PR delivers the card's ask for the object LIST page. It leaves open the record page and the card's expected first-data gain; see Acceptance notes.

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在控制台打开对象列表页时,视图定义提前约 0.3 到 0.6 秒发出;本机实测首条数据的发出时间没有可见变化,用户基本无感。
  • 为什么做:控制台首屏往返提速专项的一段,去掉列表页加载组件期间没有请求在跑的空等。
  • 出错会怎样:仍是同一个请求,只是提前发出,视图和数据都不变;最坏情况是这次读取失败时列表页会再读一次。可直接撤回。
  • 要你做什么:无。

What changes

  • AppContent (app-shell console) starts an object list's saved-view read in the commit where the route can render: the route is :objectName or :objectName/view/:viewId, the app's object scope has settled (its views are in hand from the app bundle, or from the /meta/view list it waited for), and the route's object is in the objects ObjectView is handed. Before this, the read left only when ObjectView itself committed. That waits for the list subtree's nested lazy modules (plugin-form, the icon chunks and others), because the subtree's effects run only once nothing in it is suspended.
  • The early read is the reader's own call, dataSource.listViewOverrides(objectName), not a new request. Outside a draft preview the adapter answers ObjectView's listViews and listViewOverrides from one stored, shared one-object read (readObjectViewRows: GET /meta/view?object=OBJECT, or the stored whole list narrowed). So the list joins the early read when it is in flight, or reads what it stored once it has landed. The two helpers (objectViewRouteObject, prefetchObjectViewRows) live in console/appObjectScope.ts, which is not exported from the package.
  • When no early read is started: under a draft preview (listViews reads another request there); on a route whose object the app does not serve; on a pseudo-route with no app named by the URL; with an adapter that lacks either reader. The record page is unchanged. ObjectView.tsx, MetadataProvider.tsx, spec, server and ui/apps/console are untouched.

Read first, by risk:

  1. ui/packages/app-shell/src/console/AppContent.tsx: the new effect beside routeReadsSettled. The risk is its gate, because an early read on a route ObjectView never mounts on would be an extra request.
  2. ui/packages/app-shell/src/console/appObjectScope.ts, prefetchObjectViewRows: the claim that this is the same request as the reader's.
  3. ui/packages/app-shell/src/views/ObjectView.refreshRereadsViews-13057.test.tsx: the join pin against a real ObjectStackAdapter.

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx packages/app-shell/src/views/ObjectView.refreshRereadsViews-13057.test.tsx. Expected output: Test Files 2 passed, Tests 10 passed.

Tests

  • AppContent.routeChunkPreload-12980.test.tsx, a new top-level describe in the existing chunk-gate harness:
    • (c) The read leaves once the route can render, while the ObjectView chunk import is still pending, and is not repeated after the chunk lands.
    • (d) CONTROL: an object the route does not serve sends no read.
    • (e) CONTROL: moving to a second object reads that object once.
    • (f) CONTROL: a page route sends none.
  • ObjectView.refreshRereadsViews-13057.test.tsx, a new top-level describe with the real page and a real adapter: an early read still on the wire is joined, and one that has landed is read back. In both cases there is one /meta/view request per open.
  • Both files have a module-top import '@objectstack/lint', because check:test-source-alias flags the dynamic import their source reaches.
  • Ablation (committed fix first): scripts/ablation-replace.mjs replaced the effect's prefetchObjectViewRows(dataSource, viewReadObject); with void 0;. The anchor went from 1 to 0 hits, blob 93b63bc8325c to ae3386c4d2cd. (c) and (e) failed (2 failed, 4 passed). Restored blob 93b63bc8325c equals HEAD: and git diff HEAD is empty.
Test and gate readings (head 335afc2; the last commit before it changed only the changeset prose)
  • Two files: Test Files 2 passed (2), Tests 10 passed (10), os-verify-lock exit 0 (at b1ab94e, which has the same test and source bytes as head).
  • pnpm --filter @object-ui/app-shell run type-check: exit 0, both programs (b1ab94e).
  • dispatch-gates --commands: 38 derived families, all run, all exit 0 except the two below. --ran reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.
  • check:test-source-alias was red on the first run, because the two edited test files reach a dynamic @objectstack/lint import. Both files were fixed with the module-top import, and the gate then exited 0.
  • app-shell type-check was first red with TS2493 on the untyped vi.fn mock. The mock was typed, and the check then exited 0.
  • The changeset gates (empty, no-major, ADR-0087 registration, changeset-fixed) and nul-bytes were re-run on 335afc2: all exit 0.
  • pnpm check:new-line-citations (ui): 0 new citations.

Acceptance notes

  • The record page's view read is not ObjectView's, and this PR does not change it. On /apps/APP/OBJECT/record/ID the request is the WHOLE /meta/view list, not ?object=. ObjectView does not mount there. The record's own data read leaves 200-290 ms before it. No early read can be "the same request ObjectView sends" on that route, so per the ruling zone it is left alone (readings below: 1 meta/view per load, gap unchanged).
  • The card expected first data to move up with the view read, and that mechanism is refuted. The first list data read is asked when the list mounts, not when the view read answers. Two single-load delay probes on the built console show this:
    • Holding meta/view?object= for 1.5 s did not delay the first data/showcase_task read (2562 ms, while the view answered at 3608 ms). A second, identical data read followed the view's answer (3664 ms).
    • Holding data/sys_personal_view for 1.5 s did not delay first data either.
    • So "data moves up by the same amount" does not hold. In the readings, first data minus bundle is 656-792 ms after vs 714-940 ms before (cold), and 515-1211 ms after vs 760-910 ms before (warm, shared box under load: two after-warm runs were slower).
    • What the change does give: the saved views are in hand when the list mounts. Per the probe, a view answer landing after the first data read starts a second data read. That second read showed up on 1 of 6 list loads before and 0 of 6 after. The sample is too small to claim more.
  • Failure path: the adapter stores no rejection. So if the early read fails before the list mounts, the list asks once more (its own listViews warning fires once, as before). If the early read is still on the wire, the list joins it and sees the same failure.
  • Not changed: the package README and content/docs/frontend. This adds no prop, export, metadata key or author-visible behaviour, and the claim's file surface excludes both.
Layer readings: built console, showcase app, headless Chromium, 3 loads per cell (method of #34211 / #35455)

Tree: objectstack-ai/objectstack. Before = origin/main eed422e; after = this branch at b1b970b, which has the same app-shell source as head. Built console served by objectstack dev --fresh (example-showcase) on a private port. cold = cookie only; warm = cookie plus stored Bearer. gap = from the app bundle answering to meta/view leaving. Times are shared-box ms.

page / posture before: max layers · gap · meta/view per load after: max layers · gap · meta/view per load
list cold 10/12/12 · 725/635/883 · 1/1/1 11/13/10 · 251/277/221 · 1/1/1
list warm 10/11/11 · 649/856/772 · 1/1/1 9/12/12 · 360/327/363 · 1/1/1
record cold (whole list, not ObjectView's) 13/12/11 · 511/722/551 · 1/1/1 13/13/12 · 491/718/607 · 1/1/1
record warm (whole list, not ObjectView's) 13/13/8 · 486/451/709 · 1/1/1 8/12/10 · 561/646/650 · 1/1/1
  • On the list, the view read now starts 221-363 ms after the bundle. That remainder is the render of the console chrome in the same commit: the effect fires after the commit.
  • Before the change, the ObjectView chunk itself had loaded before the bundle answered (route chunk preload). What filled the gap was plugin-view, plugins-views, objectViewOptions and plugin-form, plus 25-62 lazy icon and helper chunks.
  • Max layers stay within noise. On the list, the view read's layer dropped by about one (L9-L10 before, L8-L9 after). The first data read still sits behind the list's mount.

Generated by Claude Code

@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 19, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Final head for review · area ux-2 · 2026-11-19T16:27Z
Head: 335afc216cdfcfa531a54f911b4b6fd76b6c8c29. All check runs on it concluded: 39 success, 13 skipped, 0 failed (the PR-side subset). K = 8 (< 15, no main merge owed).
Part of #35535 · Clause-②: no · Metadata-protocol: none · +223/−6 over 5 files (source 60 lines). Not governed (0 of 5). ObjectView.tsx and MetadataProvider.tsx source untouched (ux-4 holds ObjectView.tsx for #35548).
Scope: on the object list route, AppContent starts the list's saved-view read (dataSource.listViewOverrides(objectName), the reader's own call) in the commit where the route can render; the adapter answers ObjectView's listViews/listViewOverrides from that one shared read. One meta/view per load (12/12). The view read now leaves 221-363 ms after the bundle instead of 635-883 ms.
Premise partly refuted, measured: first list data is asked when the list mounts, not when the view answers (delay probe), so first data does not move. The record page's view read is the whole /meta/view list from another reader and is off the record data path; it is left as it is. Hence Part of. Readings in os-dev-report 7014659717.
Area decisions on the dev's two open questions: land as is (no added request; removes a measured trigger of the duplicate list-data read, #35536); the record half is closed as not this mechanism at close-out.
Review route: L1-a thread. The area lands it after the ACCEPT.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:打开一个对象的列表时,"已保存视图"的读取提前到路由一确定就开始,不再等列表页面的代码加载完;视图信息更早到手,首批数据的时间不变。
  • 为什么做:以前这次读取要等页面模块加载完才发,中间空等约半秒以上。
  • 出错会怎样:仍然只发一次请求;若提前读取失败,列表页挂载时会照常再读并显示错误,和以前一样。
  • 要你做什么:无。区域审核通过后自行落地。
  • 席位意见:改动小、复用现有读取不增加请求,可以落地。

席位核对

L1-a: ACCEPT · head 335afc216cdfcfa531a54f911b4b6fd76b6c8c29 · Part of #35535 · 2026-11-19T16:29Z · reviewed to pm-dispatch text at origin/main fca72dfa32

Readings, my own.

Code.

  • objectViewRouteObject. It matches appSubPath against the same route table as the scope (plus host routes) and takes the last match. It answers only for :objectName or :objectName/view/:viewId, so a static route that shadows :objectName (search, reports) answers undefined.
  • The AppContent effect fires only when all of these hold:
    • an object-list route;
    • routeReadsSettled;
    • the object is in allObjects;
    • a bundleAppName;
    • no previewDrafts.
  • prefetchObjectViewRows. It calls the reader's own listViewOverrides(objectName), on an adapter that has both listViews and listViewOverrides. Errors are swallowed because the mounting reader re-asks and sees them. The in-repo implementer (data-objectstack async listViewOverrides) returns a promise, so .catch is safe.
  • Effect deps. The effect is keyed on the object name, so it re-runs once per object navigation and is otherwise a cached read.

Pins (names grepped).

  • AppContent.routeChunkPreload-12980:
    • (c) the read leaves while the list chunk is pending, and is not repeated;
    • (d) CONTROL: an object the route does not serve sends nothing;
    • (e) CONTROL: a second object reads once;
    • (f) CONTROL: a non-list route sends nothing.
  • ObjectView.refreshRereadsViews-13057: started and still on the wire, no second read; started and landed, reads the stored answer.
  • The ablation (2/6 red), the 12/12 one meta/view per load, and the 221–363 ms vs 635–883 ms timings are from os-dev-report 7014659717.

Nit, non-blocking. The changeset says the read is "not started under a draft preview (?preview=draft)", and the code gates on previewDrafts, but no cell pins it. A CONTROL like (d) with previewDrafts on would close it, in this PR or the next #35535 slice.

Premise. It is partly refuted, and measured: first list data is asked at list mount, so it does not move. "Part of", not "Fixes", is right, and the area's close-out of the record half as a different mechanism is recorded.

Declaration: agreed. Clause-②: no / Metadata-protocol: none / app-shell patch. No props, exports or requests are added. Changeset sentences checked against the diff:

  • the read starts when the route can render, and the page joins it;
  • "still one request per open";
  • first data unchanged;
  • not under a draft preview, nor for an object the app does not serve;
  • record page unchanged.

Routing. Not governed and no contract face: ux-2 lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Landing · area ux-2 · 2026-11-19T16:29Z

reading value
L1-a ACCEPT comment 7015260011 at head 335afc216c (= current head)
CI green at 335afc216c (39 success, 13 skipped, 0 failed); K = 8 (< 15)
check-governed-merges --pr 35579 NOT governed, 0 of 5 paths; +223 / −6; no L2 owed

Nit noted, not done here: a CONTROL pin for "no early read under a draft preview" (the code gates on it; no cell pins it).
State: draft → ready + auto-merge (merge queue). The PR says Part of #35535; the area closes #35535 at close-out (list half delivered, first-data move refuted by measurement, record half a different mechanism).

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