You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3957126
Browse filesBrowse the repository at this point in the historyBrowse files
perf(console): start an object list's saved-view read with the route, not after its lazy modules (#35579)
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
93b63bc to ae3386c4d2cd. (c) and (e) failed (2 failed, 4 passed).
Restored blob 93b63bc equals `HEAD:` and `git diff HEAD` is empty.
<details><summary>Test and gate readings (head 335afc2; the last commit
before it changed only the changeset prose)</summary>
- 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.
</details>
## 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.
<details><summary>Layer readings: built console, showcase app, headless
Chromium, 3 loads per cell (method of #34211 / #35455)</summary>
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.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
perf(console): an object list's saved-view read starts with the route, not after the list's lazy modules
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
Opening an object's list (`/apps/APP/OBJECT`, or one of its views) read the object's saved views (`GET /api/v1/meta/view?object=OBJECT`) only once the list page had mounted, which waits for the list's lazy modules to load. On the built console that read left 486-883 ms after the app bundle answered, with no request in flight. The console now starts the same read as soon as the route can render (the app's object scope has settled with the route's object in it), so it runs while those modules load, and the list page joins it when it mounts: still one request per open. The list's first data page is still asked when the list mounts; the saved views are now in hand by then.
11
+
12
+
Not started under a draft preview (`?preview=draft`), whose list read is a different request, nor on a route whose object the app does not serve. A record page is unchanged. No props, exports or metadata change.
0 commit comments