Skip to content

Commit 2955685

Browse 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>
1 parent a5a5312 commit 2955685

17 files changed

Lines changed: 581 additions & 80 deletions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/console': patch
4+
---
5+
6+
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.

‎ui/apps/console/src/AppContent.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import { lazy, Suspense, useEffect, useMemo, type ReactNode } from 'react';
1313
import { Route, useParams, useLocation, Navigate } from 'react-router-dom';
14-
import { DefaultAppContent, ENVIRONMENT_SCOPE_QUERY, LauncherAppsProvider, LoadingScreen, setupMetadataStudioPath, useAdapter } from '@object-ui/app-shell';
14+
import { DefaultAppContent, ENVIRONMENT_SCOPE_QUERY, LauncherAppsProvider, LoadingFallback, LoadingScreen, setupMetadataStudioPath, useAdapter } from '@object-ui/app-shell';
1515
import { AdapterCtx } from '@object-ui/react';
1616
import { MePermissionsProvider, ServerReadScope, releaseMePermissionsRequest, startMePermissionsRequest } from '@object-ui/permissions';
1717
import { createAuthenticatedFetch, useAuth } from '@object-ui/auth';
@@ -456,7 +456,10 @@ export function ConsolePermissionsScope({ children }: { children: ReactNode }) {
456456
endpoint={endpoint}
457457
fetcher={authFetch}
458458
requestKey={requestKey}
459-
loadingFallback={<LoadingScreen />}
459+
// objectstack#35981 — the console's boot fallback: on an app route, the
460+
// chrome's empty frame while the answer is out (it draws no navigation
461+
// entry, which is what the answer decides); the splash on `/home`.
462+
loadingFallback={<LoadingFallback />}
460463
// Without this, the provider's error state renders `loadingFallback` too —
461464
// an eternal spinner with a `retry` nobody can reach. The provider already
462465
// re-attempts a transient failure (a cold environment kernel answers 503 +

‎ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
163163
RequireOrganization: ({ children }: { children?: ReactNode }) => <>{children}</>,
164164
ConsoleToaster: () => null,
165165
LoadingScreen: () => <div data-testid="loading-screen" />,
166+
// objectstack#35981 — the permission scope's loading fallback is the console's
167+
// boot fallback, which is the splash off an app route.
168+
LoadingFallback: () => <div data-testid="loading-screen" />,
166169
DefaultHomePage: () => <HomeRosterProbe />,
167170
DefaultAppContent: () => <AppContentProbe />,
168171
BuilderLanding: () => <StudioBuilderProbe />,

‎ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
import '@testing-library/jest-dom/vitest';
9292
import { describe, it, expect, vi, beforeEach } from 'vitest';
9393
import React from 'react';
94-
import { render, screen, fireEvent } from '@testing-library/react';
94+
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
9595
import { MemoryRouter, Routes, Route, Navigate, useLocation, useParams } from 'react-router-dom';
9696

9797
// AGENTS.md §测试纪律 — the lazily-imported page modules are stubbed so no
@@ -187,11 +187,14 @@ vi.mock('@object-ui/i18n', async (importOriginal) => ({
187187
// on that chrome-less screen (pinned in
188188
// `packages/app-shell/src/console/__tests__/AppContent.inaccessibleAppStrand.test.tsx`).
189189
// The legacy `/system/*` redirect targets this file measures are unchanged.
190+
// One function for every render, as `AuthProvider`'s `useCallback` gives
191+
// (objectstack#35981: the chrome waits for its answer).
192+
const getAuthConfig = vi.hoisted(() => async () => ({ features: {} }));
190193
vi.mock('@object-ui/auth', async (importOriginal) => ({
191194
...(await importOriginal<Record<string, unknown>>()),
192195
useAuth: () => ({
193196
user: null,
194-
getAuthConfig: async () => ({ features: {} }),
197+
getAuthConfig,
195198
activeOrganization: null,
196199
}),
197200
useWorkspaceAdminStatus: () => ({ isAdmin: true, isResolved: true }),
@@ -287,20 +290,22 @@ describe('system-hub entries reach the framework system objects (objectui#3655)'
287290
expect(screen.queryByText('Page not found')).not.toBeInTheDocument();
288291
});
289292

290-
it('preserves the app prefix rather than stripping to the root', () => {
293+
it('preserves the app prefix rather than stripping to the root', async () => {
291294
// `prefix` is cut with a regex off `location.pathname`; every case above
292295
// uses the same two-segment prefix, so a mistake there is invisible in them.
293296
renderConsoleAt('/apps/my-app/system/users');
294297

295-
expect(chain).toEqual(['/apps/my-app/system/users', '/apps/my-app/sys_user']);
298+
// objectstack#35981 — the chrome (and the routes under it) mount once the
299+
// deployment flags have answered, a promise even when answered at once.
300+
await waitFor(() => expect(chain).toEqual(['/apps/my-app/system/users', '/apps/my-app/sys_user']));
296301
});
297302

298-
it('an app segment spelled `system` survives the rewrite', () => {
303+
it('an app segment spelled `system` survives the rewrite', async () => {
299304
// The regex is end-anchored precisely so the LAST `/system/<seg>` is the
300305
// one removed. An unanchored cut would leave `/apps` here.
301306
renderConsoleAt('/apps/system/system/users');
302307

303-
expect(chain).toEqual(['/apps/system/system/users', '/apps/system/sys_user']);
308+
await waitFor(() => expect(chain).toEqual(['/apps/system/system/users', '/apps/system/sys_user']));
304309
});
305310

306311
/**

‎ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
124124
RequireOrganization: ({ children }: { children?: ReactNode }) => <>{children}</>,
125125
ConsoleToaster: () => null,
126126
LoadingScreen: () => <div data-testid="loading-screen" />,
127+
// objectstack#35981 — the permission scope's loading fallback is the console's
128+
// boot fallback, which is the splash off an app route.
129+
LoadingFallback: () => <div data-testid="loading-screen" />,
127130
DefaultHomePage: () => <HomeProbe />,
128131
DefaultAppContent: () => null,
129132
BuilderLanding: () => null,

‎ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
*
3737
* ## Why the splash, and why it cannot itself flicker
3838
*
39-
* The component renders the SAME `LoadingScreen` the gate one line above was
40-
* already rendering, so the handoff changes no pixels: the transition now runs
39+
* The component renders the SAME fallback the gate one line above was
40+
* already rendering (`ConsoleBootFallback`: the splash, or on an app route
41+
* after the session read the console's frame, objectstack#35981), so the
42+
* handoff changes no pixels: the transition now runs
4143
* underneath an unchanged screen instead of underneath a blank one. That is
4244
* also why this is not "add a spinner" — a different holding image would
4345
* introduce a visual change where today there is a blank, and the goal is for
@@ -52,7 +54,7 @@
5254
*/
5355

5456
import { Navigate } from 'react-router-dom';
55-
import { LoadingScreen } from './LoadingScreen.js';
57+
import { ConsoleBootFallback } from '../console/ConsoleBootShell.js';
5658

5759
export interface RedirectWithSplashProps {
5860
/** Where to go — the same value a bare `<Navigate to={…}>` would take. */
@@ -66,8 +68,10 @@ export function RedirectWithSplash({ to, replace }: RedirectWithSplashProps) {
6668
<>
6769
{/* Order is not load-bearing — `<Navigate>` renders null — but the
6870
splash is written first so the element that OCCUPIES the screen reads
69-
first at every call site. */}
70-
<LoadingScreen />
71+
first at every call site. objectstack#35981 — the boot gates' own
72+
fallback, so on an app route after the session read it is the
73+
console's frame those gates were showing, and the splash elsewhere. */}
74+
<ConsoleBootFallback />
7175
<Navigate to={to} replace={replace} />
7276
</>
7377
);

‎ui/packages/app-shell/src/console/AppContent.tsx‎

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { ConsoleLayout } from '../layout/ConsoleLayout.js';
4949
import { CommandPalette } from '../chrome/CommandPalette.js';
5050
import { ErrorBoundary } from '../chrome/ErrorBoundary.js';
5151
import { LoadingScreen } from '../chrome/LoadingScreen.js';
52+
import { ConsoleBootShell, RouteMetadataSkeleton } from './ConsoleBootShell.js';
5253
import { BackToHomeButton, NotFoundState } from '../components/NotFoundState.js';
5354
import { RedirectWithSplash } from '../chrome/RedirectWithSplash.js';
5455
// `ObjectNotFoundState` from its own module, not through `ObjectView`: the
@@ -67,7 +68,7 @@ import {
6768
navEntriesShownOncePendingReadsShow,
6869
} from '../hooks/useNavMemberGates.js';
6970
import { resolveSetupAppPath } from './ConsoleShell.js';
70-
import { APP_ROUTE_METADATA_READS, collectRoutePaths, metadataReadsForAppRoute, type LazyMetadataType } from './appRouteMetadataReads.js';
71+
import { APP_ROUTE_METADATA_READS, collectRoutePaths, metadataReadsForAppRoute } from './appRouteMetadataReads.js';
7172
import { enterAppBundle, objectViewRouteObject, prefetchObjectViewRows, readAppObjectScope } from './appObjectScope.js';
7273
import { preferLocal } from '../utils/preferLocal.js';
7374
import {
@@ -77,7 +78,7 @@ import {
7778
setupMetadataStudioPath,
7879
} from '../views/studio-design/setupMetadataRedirect.js';
7980
import { NO_RECORD_DRAWERS_OPENING, NO_RECORD_PAGE_DRAWERS_OPEN, RecordDrawerOpeningProvider, RecordPageDrawerOpenProvider, useRecordFormOpensOverDrawers, type RecordDrawersOpening, type RecordPageDrawersOpen } from '../views/recordDrawerStack.js';
80-
import { SkeletonDashboard, SkeletonDetail, SkeletonGrid } from '../skeletons/index.js';
81+
import { SkeletonGrid } from '../skeletons/index.js';
8182

8283
// Route-based code splitting — lazy-load less-frequently-used routes.
8384
//
@@ -331,15 +332,29 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
331332
// it empty until the fetch resolves so predicates default to "visible"
332333
// and we don't briefly hide UI on slow networks.
333334
const [features, setFeatures] = useState<Record<string, any>>({});
335+
// objectstack#35981 — whether that answer (or its failure) is in. The
336+
// readiness gate below holds the chrome on it: the chrome's navigation
337+
// gates bind `features`, and a navigation predicate that names a flag not
338+
// bound yet FAULTS and withholds its entry (objectui#12700), so a chrome
339+
// mounted before the answer would hide a flag-gated entry and then draw it.
340+
// Until the chrome stopped waiting for the route's own reads, that answer
341+
// was in first only by timing.
342+
const [featuresSettled, setFeaturesSettled] = useState(false);
334343
useEffect(() => {
335344
let cancelled = false;
345+
if (typeof getAuthConfig !== 'function') {
346+
setFeaturesSettled(true);
347+
return;
348+
}
336349
getAuthConfig()
337350
.then((cfg) => {
338351
if (cancelled) return;
339352
setFeatures((cfg?.features as Record<string, any>) ?? {});
353+
setFeaturesSettled(true);
340354
})
341355
.catch(() => {
342356
/* leave empty — predicates default to visible */
357+
if (!cancelled) setFeaturesSettled(true);
343358
});
344359
return () => {
345360
cancelled = true;
@@ -609,10 +624,11 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
609624
if (!viewReadObject || !viewReadReady || !bundleAppName || previewDrafts) return;
610625
prefetchObjectViewRows(dataSource, viewReadObject);
611626
}, [dataSource, viewReadObject, viewReadReady, bundleAppName, previewDrafts]);
612-
// Set once the first frame past the splash has rendered. After it, a route
613-
// waiting on its buckets draws its skeleton inside the console chrome rather
614-
// than taking the whole console back to the splash.
615-
const firstPaintDone = useRef(false);
627+
// objectstack#35981 — set once this page load's first route has drawn. Until
628+
// then the route slot's skeleton is the boot wait (`RouteMetadataSkeleton`'s
629+
// `boot`), so what waits for the first paint past the splash still waits for
630+
// the route (objectui#12980), while the chrome is already on screen.
631+
const firstRouteDrawn = useRef(false);
616632

617633
// A normal app was requested but isn't present in the loaded metadata — the
618634
// post-publish readiness lag, or a genuinely-missing app. Applies in BOTH
@@ -1214,17 +1230,21 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
12141230
// `positions[]` leg, which is every admin on a session minted with an active
12151231
// organization stamped) waits exactly zero extra frames. What does wait is
12161232
// the viewer whose verdict genuinely is not known yet — and for them a
1217-
// LoadingScreen is the honest frame, not a screen built on a guess.
1233+
// frame that decides nothing is the honest one, not a screen built on a guess.
12181234
//
1219-
// objectui#12809 — of the lazy metadata, the splash waits only for what the
1220-
// current route reads (`routeReadsSettled`), and only until the first paint.
1221-
if (
1222-
!dataSource ||
1223-
metadataLoading ||
1224-
!isWorkspaceAdminResolved ||
1225-
(!firstPaintDone.current && !routeReadsSettled)
1226-
) return <LoadingScreen />;
1227-
firstPaintDone.current = true;
1235+
// objectui#12809 — the lazy metadata the current route reads does not hold
1236+
// the gate at all (objectstack#35981): the chrome decides nothing from it,
1237+
// so it mounts once the inputs above are in, and the route slot draws the
1238+
// route's skeleton until its reads land (`routeReadsSettled`, below).
1239+
//
1240+
// objectstack#35981 — while the gate holds, the console chrome's empty frame
1241+
// (`ConsoleBootShell`), not the full-screen splash: it names no app and draws
1242+
// no navigation entry, which is exactly what the inputs above decide.
1243+
//
1244+
// objectstack#35981 — and the deployment flags (`featuresSettled`, above):
1245+
// the chrome's navigation gates read them.
1246+
if (!dataSource || metadataLoading || !isWorkspaceAdminResolved || !featuresSettled) return <ConsoleBootShell />;
1247+
if (routeReadsSettled) firstRouteDrawn.current = true;
12281248

12291249
// ADR-0037 — preview mode renders its OWN empty/error states and never
12301250
// falls through to the generic "No Apps Configured" guard below: inside a
@@ -1296,7 +1316,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
12961316
// page; `denied` is the screen above, and every other verdict falls through
12971317
// to the pseudo-route rendering below, unchanged.
12981318
if (appSurfaceAwaitsVerdict && !previewDrafts) {
1299-
if (accessVerdict === null) return <LoadingScreen />;
1319+
if (accessVerdict === null) return <ConsoleBootShell />;
13001320
if (accessVerdict === 'denied') return renderAppAccessDenied();
13011321
}
13021322

@@ -1305,7 +1325,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
13051325
// different app, and don't show the misleading "no apps configured" screen
13061326
// below (there ARE apps). requestedAppMissing already excludes pseudo-routes.
13071327
if (requestedAppMissing) {
1308-
if (missingRecheck !== 'done' || accessVerdict === null) return <LoadingScreen />;
1328+
if (missingRecheck !== 'done' || accessVerdict === null) return <ConsoleBootShell />;
13091329
if (accessVerdict === 'denied') return renderAppAccessDenied();
13101330
// objectui#9262 — the remaining verdicts, each saying only what the probe
13111331
// obtained. The screen this replaced asserted ONE transient deploy state
@@ -1416,7 +1436,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
14161436
// guard reads only the per-user-filtered list that ships today.
14171437
if (!activeApp && !isCreateAppRoute && !isSystemRoute && !isMetadataRoute && !isWorkspaceAdmin) {
14181438
// `RedirectWithSplash`, not a bare `<Navigate>` (objectui#6378 / #6507).
1419-
// Every readiness gate above this branch renders `LoadingScreen`, and the
1439+
// Every readiness gate above this branch renders a boot frame, and the
14201440
// branch returns ABOVE the single `ConsoleLayout` mount — so a bare
14211441
// redirect, which renders null, hands the WHOLE viewport back to the page
14221442
// background while `/home` renders at transition priority. Measured on the
@@ -1571,11 +1591,15 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
15711591
<OnboardingWalkthrough />
15721592
<DraftReviewNavigator appName={appName} />
15731593
<ErrorBoundary>
1574-
<Suspense fallback={<LoadingScreen />}>
1594+
{/* objectstack#35981 — a route element whose chunk is still loading
1595+
draws the route's skeleton in the slot, not the full-screen
1596+
splash inside the chrome. It is the boot wait as that splash
1597+
was (`data-boot-splash`), whenever it shows. */}
1598+
<Suspense fallback={<RouteMetadataSkeleton reads={routeReadsKey || 'object'} boot />}>
15751599
<RouteFader className="h-full">
15761600
{/* objectui#12809 — the route's metadata has not landed: its
15771601
skeleton, never its empty or "not found" state. */}
1578-
{!routeReadsSettled ? <RouteMetadataSkeleton reads={routeReadsKey || 'object'} /> : objectScope && routeObjectReadsFailed.length > 0 ? (
1602+
{!routeReadsSettled ? <RouteMetadataSkeleton reads={routeReadsKey || 'object'} boot={!firstRouteDrawn.current} /> : objectScope && routeObjectReadsFailed.length > 0 ? (
15791603
// objectui#13052 — the route's object read failed (a 5xx, a
15801604
// network drop, a code this build does not know): say so in
15811605
// the shell, and let Retry ask those names once more.
@@ -2328,12 +2352,3 @@ function useLazyMetadataSettled(
23282352
return settled;
23292353
}
23302354

2331-
/** The route slot while its metadata loads, shaped like what will land there. */
2332-
function RouteMetadataSkeleton({ reads }: { reads: string }) {
2333-
const types = reads.split(',') as LazyMetadataType[];
2334-
return (
2335-
<div data-testid="route-metadata-skeleton" className="h-full">
2336-
{types[0] === 'dashboard' ? <SkeletonDashboard /> : types.includes('page') ? <SkeletonDetail /> : <SkeletonGrid />}
2337-
</div>
2338-
);
2339-
}

0 commit comments

Comments
 (0)