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 2955685
Browse filesBrowse the repository at this point in the historyBrowse files
perf(console): an app route draws the console's frame right after the session read, and the chrome no longer waits for the route's reads (#36014)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuXu8529KKMpkikFhpmiBwMt)_
Part of #35981
Clause-②: no
Metadata-protocol: none
Skills-docs: none — no authorable metadata changes (Metadata-protocol:
none)
repo:objectstack#1 · os-sales · session_01L6bhgWwKdjqiYQSujUXhn7
## 维护者速读
-
用链接或刷新整页打开任何应用页(记录页、列表页等)时,登录状态一确认,整屏的「正在打开你的控制台…」就换成控制台的空框架:顶栏、侧栏(宽度和用户上次留下的一样)、和页面形状一样的灰色骨架。本地测量:整屏启动画面从约
1.1 秒提前到约 0.4 秒消失;把权限接口模拟成托管环境的 3 秒时,从约 3.8 秒提前到约 0.4 秒。
-
骨架里不出现应用名称、图标、任何菜单项或按钮:这些要等应用列表、权限和管理员判定回来才知道,所以「闪一下别的应用」「闪一下没权限的菜单」「误跳转」都不会发生,判定的输入和时机与改动前完全相同。
- 记录内容出现的时间不变(本地约 1.5 秒,模拟 3 秒权限时约 4.2 秒),没有变慢;本 PR
只改「等待时看到什么」。数据本身更早发出要动权限前置读取,另议。
- 出错时最坏情况是骨架和真实框架之间有一次位置跳动,可直接撤回;不改任何接口和返回格式。托管环境前后对比要等部署后才能测,卡片保持打开(本
PR 写 Part of),由座位安排。
## What changes
- New `ui/packages/app-shell/src/console/ConsoleBootShell.tsx`:
- `ConsoleBootShell`: the console chrome's frame with nothing in it. The
real `AppShell` from `@object-ui/layout` (same sidebar primitive and
route-slot classes as `ConsoleLayout`; since #36187, no top bar from 768
px up and grey blocks where the sidebar's head puts the app menu, the
search and the bell and its foot the account; the 48 px top bar on a
phone and on a docs page), `primeConsoleSidebarOpen` run before the
sidebar provider reads its cookie (as `ConsoleLayout` does), grey blocks
in the bar and the sidebar, and in the slot the skeleton of the route
the URL names (`metadataReadsForAppRoute`). No text, no link, no button.
It draws the shape the chrome will have on the route and width, from the
same predicates `ConsoleLayout` reads (`showHeader={(phone || docsPage)
&& !recordPageOwnsTopBar}`) (moved to `layout/consoleRoutePaths.ts`,
re-exported from `ConsoleLayout`): no sidebar on an app's docs pages
(`isAppDocsPath`, #36000) and no top bar on a phone record page
(`isRecordPagePath`, objectstack#28483). It carries `data-boot-splash`
(it is still the boot wait) and `data-boot-shell`.
- `ConsoleBootFallback`: the frame on an `/apps/:app/*` route once
`useAuth()` has answered with a user; `LoadingScreen` while the session
read is out, with no user, on every other route (`/home`, auth surfaces,
`/forms/…`), and outside a router.
- `RouteMetadataSkeleton` moved here from `AppContent.tsx`, with a
`boot` flag that adds `data-boot-splash`.
- `ConsoleShell.tsx` `LoadingFallback` renders `ConsoleBootFallback`.
That covers the gates between the session read and `AppContent`:
`ConnectedShellInner` (adapter), `RequireOrganization` (organization
list) and the console host's `ConsolePermissionsScope`
(`ui/apps/console/src/AppContent.tsx`, now
`loadingFallback={<LoadingFallback />}`; its error fallback is
unchanged).
- `AppContent.tsx`:
- The readiness gate draws `ConsoleBootShell` instead of
`LoadingScreen`, and holds only on the adapter, the app list, the admin
verdict (objectui#5619) and the deployment flags (`/auth/config`). The
flags are new to the gate: the chrome's navigation gates read them, and
a navigation predicate naming a flag (`features.cloudManaged != true`)
faults and withholds its entry while none are bound (objectui#12700).
Before, the route's own reads made the chrome mount after that answer by
timing only; with them off the gate, Live E2E UI caught the fault
(`list-row-action-cel`), reproduced locally by holding `/auth/config` 2
s. The first-paint wait on the route's own buckets (`!firstPaintDone &&
!routeReadsSettled`, objectui#12809) is gone: the chrome mounts, and the
route slot shows `RouteMetadataSkeleton` until `routeReadsSettled`, the
path a later navigation already took.
- The two access-verdict waits before the chrome
(`appSurfaceAwaitsVerdict`, `requestedAppMissing`) draw the frame too.
- The route slot's `Suspense` fallback is `RouteMetadataSkeleton … boot`
instead of the full-screen `LoadingScreen` inside the chrome (measured
locally: 0.2 s of logo splash inside the chrome while the record page's
chunk resolved).
- `firstRouteDrawn` (replaces `firstPaintDone`) keeps the first route
skeleton's `data-boot-splash` until the route's reads have landed once.
- `RedirectWithSplash` paints `ConsoleBootFallback` instead of
`LoadingScreen`, so a boot redirect out of a gate that was drawing the
frame (`RequireOrganization` → `/organizations`, `AppContent` → home)
still changes no pixels during its hand-off (objectui#6378).
Read first (risk order):
1. `AppContent.tsx`, the readiness gate and the route slot
(`RouteMetadataSkeleton`, the `Suspense` fallback).
2. `ConsoleBootShell.tsx`, `RoutedBootFallback`'s conditions.
3. `ConsoleShell.tsx` `LoadingFallback`, `RedirectWithSplash.tsx`.
## Why
An `/apps/:app/*` open passed five gates in a row, each drawing the
full-screen splash: `AuthGuard` (`get-session`), `ConnectedShellInner`
(adapter), `RequireOrganization` (`organization/list`),
`ConsolePermissionsScope` (`/auth/me/permissions`, more than 3 s
server-side on the hosted environment, #35987), then `AppContent`'s gate
(app list, admin verdict, the route's own reads until the first paint).
Only the first decides whether there is a session. The others decide
which app this is, which navigation exists and where to redirect, and
the frame shows none of those.
What each guarantee rests on, unchanged:
- **No wrong-app flash**: the frame names no app. The chrome still
mounts only once the app list is in and the URL's app is matched;
`requestedAppMissing` and the access-verdict screens are unchanged.
- **No unauthorised-menu flash**: navigation entries come only from the
real chrome (`UnifiedSidebar`, `AppHeader`), which still mounts after
the permission answer and the admin verdict.
- **No redirect loop or wrong redirect**: the frame never navigates; the
no-active-app redirect still waits for the admin verdict, and the
organization redirects for their own inputs.
- **Boot-paint semantics** (objectui#12980, readiness waits): the frame
and the first route skeleton carry `data-boot-splash`, so the chrome's
deferred feeds (`sharedUserFeeds`), the locale list (`loadLocales`) and
the e2e/smoke waits keyed on that marker wait for exactly what they
waited for before.
What the chrome reads before the route's buckets land:
`ConsoleLayout`/`AppHeader`/`CommandPalette` get the object list the
route has so far (the scope's or none). The header's object crumb is
absent until the object lands, as on any later navigation today. Nothing
in the chrome decides from it.
## Verification
### Before/after, the same record page (local and throttled, not hosted)
`examples/app-showcase` (`pnpm dev -- --fresh`, seeded admin), behind a
local HTTP/2 TLS proxy (#35987's recipe), Chromium 1280×800, zh-CN, JS
cached, DevTools throttling 300 ms RTT / 6 Mbps, 3 runs per row,
full-page open of
`/_console/apps/com.example.showcase/showcase_project/record/<id>`.
Seconds from navigation start. Paint milestones from a MutationObserver:
full-screen splash gone (no `LoadingScreen` left and the pre-JS splash
gone), frame drawn (`data-boot-shell`), chrome drawn (`console-route`),
record shown (its name in the route slot). The second profile holds
`/auth/me/permissions` 3 s in the proxy, a stand-in for the hosted
server time (simulated, not measured hosted).
| Profile | | `get-session` answered | full-screen splash gone | chrome
drawn | record shown |
|---|---|---|---|---|---|
| 300 ms / 6 Mbps | before | 0.38 / 0.40 / 0.35 | 1.69 / 1.15 / 1.09 |
1.51 / 0.96 / 0.87 | 2.10 / 1.52 / 1.46 |
| | after | 0.44 / 0.35 / 0.36 | **0.69 / 0.37 / 0.37** (frame) | 1.19 /
0.81 / 0.82 | 1.89 / 1.50 / 1.52 |
| + permissions held 3 s | before | 0.47 / 0.45 / 0.35 | 4.03 / 3.87 /
3.78 | 3.79 / 3.62 / 3.57 | 4.40 / 4.25 / 4.16 |
| | after | 0.42 / 0.41 / 0.35 | **0.74 / 0.44 / 0.37** (frame) | 3.89 /
3.63 / 3.52 | 4.53 / 4.26 / 4.15 |
- The frame replaces the splash within about 20 ms of the session answer
in runs 2 and 3 (run 1 of each row is the first open after the warm-up
and starts its reads late), before `/meta/page` answers (0.73–1.10) and
well before the permission answer.
- "Before" splash gone comes after "chrome drawn" because the chrome
mounted with the full-screen `LoadingScreen` inside it while the record
page's chunk resolved; after, that slot shows the record skeleton.
- Chrome drawn and record shown do not move beyond run noise: the
record's data read still leaves after the permission answer and the
record page's mount (`POST …/page` sent at the same times before and
after). Moving that read earlier is a different change (a data read
before the permission answer), not taken here.
- ⚠ Gap: the hosted environment is not reachable from this container,
and an "after" there exists only once this is deployed. The hosted
before/after (#35981's scope addition: segment timings before #35987 and
after this PR, and `/api/v1/packages` off the boot path) is owed after
deploy; the card stays open for it.
Screenshots after #36187 (`after2-1440-*`, `after2-375-*`: frame, then
loaded) and, from the first round, (frame → chrome → record) at 1280×800
(sidebar folded by the window width, as the chrome folds it), 1600×900
(sidebar open, same width in frame and chrome) and iPhone 13, the raw
runs (`*.json`, `summary.txt`), the measurement script and the proxy:
`/mnt/project-files/build-seat1/35981/` in the project files.
### Tests
-
`ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx`
(new, 7 cases): the frame on an app route with a user, carrying
`data-boot-splash`, the top bar and the route skeleton;
`LoadingFallback` draws it; a boot redirect paints it at its first
commit and then lands; the frame has no text and nothing to press; no
sidebar on a docs page and no top bar on a phone record page, with the
sidebar and the bar kept everywhere else; the splash while the session
read is out, with no user, on `/home`, `/login`, `/forms/…`, bare
`/apps`, and outside a router.
- `AppContent.splashCriticalPath-12809.test.tsx` (amended): before the
member row answers, the frame and no chrome; after it, the chrome with
the route skeleton carrying `data-boot-splash`; the splash marker leaves
when the route draws, as before. The two CONTROL cases are unchanged and
pass (a later skeleton is not the boot wait).
- Amended where the old splash was the expected frame:
`AppContent.routeChunkPreload-12980` (case (a): the chrome is up under
the route skeleton while the page's reads are out; the inside-the-chrome
watcher counts the full-screen splash only, and case (b) now sees the
route skeleton, not a splash, while the chunk loads),
`bootRedirectCoverage` (the boot frame counts as full-viewport cover),
and the `LoadingFallback` mock in `App.homePermissions-12700` and
`FormPage.routePermissions-29187` (the permission scope's fallback). All
four pass.
- Local run of `packages/app-shell/` and `apps/console/`: the first full
run hit its 50-minute limit in this 4-core container after reaching
those four reds and nothing else. The scoped rerun after the fixes
(app-shell `console/`, `chrome/`, `layout/`, `hooks/`, and
`apps/console/`): 892 files, 7992 tests, all pass. CI's Test UI shards
carry the whole suite and are green on the head.
- `AppContent.splashCriticalPath-12809`: a new case holds `/auth/config`
and pins frame-not-chrome until it answers (red with the gate line
reverted). `AppContent.unresolvedAdmin-5619` (three cases, including the
MUST NOT CHANGE one) now awaits the chrome, since the flags' answer is a
promise even when the mock gives it at once; the admin verdict still
adds no wait. `AppContent.emptyNavigationLanding-12079` gets a stable
`getAuthConfig`, as `AuthProvider`'s `useCallback` gives, since a fresh
one per render re-asks on every render.
- After merging `main` and the L1-b should-fixes: app-shell `console/`,
`layout/`, `chrome/`: 465 files, 3659 tests, all pass; `pnpm
console:build` green.
- `pnpm check:test-source-alias`: the amended boot-path test now mounts
the chrome, which reaches `@objectstack/lint` lazily; it loads it at
module top, as the gate asks. Green.
- `pnpm console:build` (runs `tsc` for app-shell and the console):
green.
- ESLint on the changed files: no errors.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(No spec change.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes (changed files).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset
(`.changeset/35981-app-route-boot-frame.md`, patch), 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 (the maintainer summary
is in Chinese by the maintainer's standing rule).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
Follow-up (not in this PR): the record's own data read waits for the
permission answer and the record page's mount; starting it earlier would
need its own card (it reads data before the permission answer arrives).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgWwKdjqiYQSujUXhn7 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
perf(console): an app route draws the console's frame right after the session read, and the chrome no longer waits for the route's own metadata
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
Opening an app page by its URL (a reload, a pasted link) showed the full-screen splash until the permission answer, the app list, the admin verdict and the page's own metadata reads had all arrived. On a hosted environment the permission answer alone takes seconds.
12
+
13
+
-`LoadingFallback` (the console's boot-gate fallback) and `AppContent`'s readiness gate now draw `ConsoleBootShell` on an `/apps/:app/*` route once the session has answered with a user: the chrome's frame (the sidebar at the width the reader left it, from 768 px up with grey blocks where its head and foot put the app menu, the search, the bell and the account; the top bar on a phone, except on a record page, and on an app's docs pages, which have no sidebar; the route's skeleton in the slot: the shape the chrome draws on that route), with no app name, no navigation entry and nothing to press, because those are what the gates still decide. The splash stays for the session read itself and for every other route. The console's permission scope uses the same fallback.
14
+
-`AppContent` mounts the console chrome once the app list, the permission answer, the admin verdict and the deployment flags (`/auth/config`, which the chrome's navigation gates read) are in; the route's own metadata reads no longer hold it on the first paint. The route slot draws the route's skeleton until they land, and a route element whose chunk is still loading draws the same skeleton instead of the full-screen splash inside the chrome.
15
+
- The frame and the first route skeleton carry `data-boot-splash`, so readiness waits and the reads deferred to the first paint past the splash wait exactly as before; `data-boot-shell` tells the frame apart.
0 commit comments