Skip to content

Commit 2b57044

Browse files
perf(console): the first load stops downloading the grid and detail packages (#36336)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X1qGnTYLQs3EtmtCmjrcfCe)_ Fixes #33581 Clause-②: yes (widening) — one new published `exports` subpath, `@object-ui/plugin-detail/core`; nothing removed or renamed, the package root exports the same names as before Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:控制台第一次打开任何页面时少下载约 165 KB(压缩后,约为首屏下载量的 8%);首页、仪表盘、列表页、记录页、记录浮层画面和操作都不变。 - 为什么做:控制台首屏提速——过去每个页面都要先下载表格和详情组件,再去读数据。 - 出错会怎样:若某处漏改,表格或详情块第一次出现时会多等一次加载,画面内容不变;本改动可以直接撤回。 - 要你做什么:无。 ## What changes On every route the console used to download the `plugin-grid` chunk (all of `@object-ui/plugin-grid` plus 77 `@object-ui/plugin-detail` modules, 183 KB gzip) before its first data read. That chunk now leaves the eager closure; the list and record routes fetch it with their own route chunks, and any other surface fetches it the first time it draws a grid or a detail block. - **`@object-ui/plugin-detail/core`** (new subpath, ESM only, like the other `/core` subpaths): the pure helpers the console shell needs on every page, registering nothing. Names: `isRefusedFeedRead`, `relatedListEntryNames`, `RELATED_ARRANGEMENT_RECORD_VERSION`, `relatedArrangementFromRecord`, `relatedArrangementToRecord`, `deriveFieldGroupDetailSections`, `deriveHighlightFields`, `resolveDetailSections`, `isWideFieldType`, `prefetchRelatedCounts`, `relatedCountTargetsIn`, `COMPACT_RELATED_ROWS`, `normalizeRelatedListSort`, `seedQueueClaimDecision`, `seedRecordFieldAccess`, `seedRecordVerdict`, type `RelatedArrangement`. The root still exports all of them. `normalizeSortSpec` moved verbatim from `RelatedList.tsx` to `relatedListSort.ts` so the subpath does not reach the component. - **Published ESM build of plugin-detail**: a second pass (`vite.es.config.ts`) emits `index` and `core` in one pass with `preserveModules`, so the record-page caches the `/core` seeds write are the same module instances the root's hooks read. File names match the package's existing `sideEffects` spellings (`./dist/queueClaim.js` and friends). The UMD build is unchanged. - **Console shell** (`@object-ui/app-shell`): eight modules take the helpers from `/core`. The record pointer card's key fields and the approval decision's child tables draw `HeaderHighlight` / `RelatedList` through `lazy()` wrappers (`lazyDetailSurfaces.tsx`); the pointer card starts the chunk load beside its record read (no timeout raised). A wrapper mounted after the chunk loaded draws without suspending. - **Console** (`register-plugins.ts`): the bare `import '@object-ui/plugin-grid'` / `import '@object-ui/plugin-detail'` become `registerLazy` stubs for every tag the two packages register, with the namespaces their registrations declare: `object-grid`, `view:grid`, `detail-view`, `detail-section`, `view:detail`, and the eleven `record:` blocks (`details`, `related_list`, `highlights`, `activity`, `chatter`, `discussion`, `path`, `quick_actions`, `history`, `reference_rail`, `alert`). `App.tsx` loads the dev-only row-actions page lazily. `vite.config.ts` gets a `plugin-detail-core` chunk group so the subpath's closure does not fall into the `plugin-grid` group. The card's other two slices were already in place on main: `plugin-form` and `plugin-view` were lazy behind their `/core` subpaths (#34176), and `RecordDetailView` / `ObjectView` sat behind the lazy route boundary (#33677). Step 1 below shows it. ### Step 1: main `29556850`, what held each package eager Eager closure 2,042,500 B gzip, 105 of 2551 chunks. Largest eager chunks: `vendor-objectstack` 673,811 · `ui-components` 351,125 · **`plugin-grid` 183,395** · `index` 135,521 · `framework` 88,559 · `vendor-react` 81,619 · `i18n-locale-en` 66,610 · `vendor-radix` 59,724 · `src` 43,005 · `infrastructure` 37,749. | Package | Eager on main? | Edges holding it | |---|---|---| | plugin-grid (chunk = 74 grid + 77 detail modules) | yes, 183,395 B | `register-plugins.ts` bare imports of grid and detail; `App.tsx` to `dev/DevRowActions.tsx` (ObjectGrid); app-shell named imports from the plugin-detail root in `sharedUserFeeds`, `deriveRelatedLists`, `workspacePreference`, `recordDetailSections`, `recordDrawerStack`, `recordPagePayload`, `SubmittedRecord` (RelatedList), `RecordPreviewCard` (HeaderHighlight) | | plugin-form | no (only `plugin-form-core`, 6,652 B) | none; lazy since #34176 | | plugin-view | no (only `plugin-view-core`, 1,789 B) | none; lazy since #34176 | | RecordDetailView | no | none; behind the lazy route boundary since #33677 | ### Before / after | Build | Eager gzip bytes | Eager chunks | grid / form / detail / RecordDetailView eager | |---|---|---|---| | main `337f435c` | 2,043,450 | 105 | `plugin-grid` 183,666 | | this branch `feb24f53` (same base) | 1,874,495 (**−168,955**) | 105 | none; `plugin-detail-core` 15,702 joins | | this branch head `58e12ffd` (main `99fbaa6d` merged) | 1,875,181 | 105 | none (`plugin-detail-core` 15,702, `plugin-form-core` 6,654, `plugin-view-core` 1,789) | The head row includes main's own drift between the two merges (for example `ui-components` +662 B). `check:eager-closure` on head: exit 0, 1831.2 KB, headroom 600.4 KB. Lazy chunks, gzip (python gzip -6, main `337f435c` vs head `feb24f53`): `plugin-grid` 183,368 / 188,399 · `plugins-views` 62,376 / 55,420 · `plugin-form` 47,198 / 47,212 · `plugin-view` 19,846 / 19,846 · `RecordDetailView` 29,554 / 30,003. The grid chunk grows by the detail renderers that left `plugins-views`. ## Tests Local, scoped (CI runs the full suites): - Before the last main merge, head `feb24f53`: 406 test files (app-shell tests of every touched module, all console `__tests__`, plugin-detail, the `ui/scripts` side-effects and declared-lazy-views tests): 405 passed, 1 failed (`RecordPreviewCard.test.tsx`, the highlight strip under the new lazy wrapper). Fixed in `feb24f53`; that file plus the pins rerun: 13 files / 149 tests passed. - `type-check` for `@object-ui/plugin-detail`, `@object-ui/app-shell`, `@object-ui/console`: exit 0 (on `feb24f53` and again on `58e12ffd`). eslint on the changed files: exit 0. `vitest` over `scripts/`: 5127 tests passed. - Head `58e12ffd` (after merging main `99fbaa6d`): full turbo build exit 0, eager-closure budget exit 0, type-checks exit 0. The scoped test rerun on this head (493 files) was still running when this body was written (handover cut-off): **NOT MEASURED on `58e12ffd`**, CI is the reading. Pins: `ui/packages/app-shell/src/__tests__/pluginCoreSubpaths-33581.test.ts` now also holds `plugin-detail/core` (names, no registrations) and the eager modules (App, register-plugins, the eight shell modules, `lazyDetailSurfaces`) to subpath-or-type-only imports of plugin-detail and plugin-grid. Ablations (one-shot, on committed head `feb24f53`, each restored with `git checkout HEAD --`, blob hash compared, `git diff HEAD` empty): 1. `recordPagePayload.ts` back to the plugin-detail root import: all three pin tests red (offender listed, importer floor 8 of 9). 2. bare `import "@object-ui/plugin-grid"` added to `register-plugins.ts`: the bare-import pin red ("bare import from '@object-ui/plugin-grid'"). The first attempt at this ablation was a no-op (the replacement contained the anchor; the replace tool refused it); redone with a different quote spelling. ## Acceptance notes - Real browser (Chromium, showcase app, signed in as admin; the same server served the `337f435c` console build and then this branch's), five routes: home, a dashboard, an object list, a record page, a record overlay. All five drew on both builds with the same text, no page errors beyond a 404 the home page shows on both, no failed requests. - main fetched `plugin-grid` 40–75 ms after navigation on every route, before the first data read (667–1144 ms). - this branch: home and dashboard never fetch `plugin-grid`; the list fetches it at 1032 ms beside `ObjectView` (1050); the record page at 882 ms beside `RecordDetailView` (900); the overlay at 1027 ms. - JS requests per route (main / head): home 105 / 105, dashboard 143 / 140, list 227 / 201, record 171 / 156, overlay 229 / 203. - No carve-out naming `plugin-grid` is added to the eager-closure budget check, and none is owed. New gates are "no" by default unless the maintainer names one, and this class is already held by two things: the source pin `pluginCoreSubpaths-33581` (ablation 2 turns it red) and the total `check:eager-closure` budget. - `plugin-detail-core` (15,702 B gzip at this head) also holds `ConcurrentUpdateDialog`, because `isConcurrentUpdateError` is in the same module. That share of the chunk is not measured on its own. ## Verification Read first: 1. `ui/apps/console/src/register-plugins.ts` — a tag the two packages register but the stubs miss would draw an unresolved component on first use. 2. `ui/packages/plugin-detail/vite.es.config.ts` + `package.json` — the published ESM layout changes to one file per module; the seed caches depend on it. 3. `ui/packages/app-shell/src/views/lazyDetailSurfaces.tsx` — first-draw loading of the two shell detail components. Two-minute check: `pnpm --filter @object-ui/console build`, then `node -e 'const j=require("./ui/apps/console/dist/eager-closure.json");console.log(j.eagerGzipBytes, j.files.filter(f=>/^(plugin-|RecordDetailView|plugins-)/.test(f.name)).map(f=>f.name))'` from the repo root. Expected: about 1,875,000, and only `plugin-chatbot-core`, `plugin-detail-core`, `plugin-form-core`, `plugin-view-core`, with no `plugin-grid`. Gates: `node scripts/pm/dispatch-gates.mjs --commands` derived 60 families on `f3214b28`; all 60 ran locally and `--ran` reconciled 60 of 60, 0 NOT MEASURED, exit 0. First runs of four families read wrong and were rerun after a full build: dts-closure exit 1 (console `.d.ts` not built yet), dual-build-cjs-loads exit 3 (prerequisite unbuilt), query-options-erasure 124 (my own 300 s timeout), type-check-debt (I stopped its lock-held rebuild); all four reran to exit 0. UI extras: `check:side-effects-array` 0, `check:sdui-registration-pins` 0, `check:eager-closure` 0, `vite-declared-lazy-views` passed inside the builds (13 of 13 lazy). The gate set was not rerun on `58e12ffd` (a clean main merge); the PR check-runs are the reading there. Written by `repo:objectstack#4 · os-project-manager · session_01FEkQ5kt9AD1TPLy7Y9oa9D` (https://claude.ai/code/session_01FEkQ5kt9AD1TPLy7Y9oa9D). 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#4 · os-project-manager · session_01FEkQ5kt9AD1TPLy7Y9oa9D --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1d72662 commit 2b57044

24 files changed

Lines changed: 369 additions & 55 deletions
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
'@object-ui/app-shell': patch
4+
'@object-ui/console': patch
5+
---
6+
7+
perf(console): the first load stops downloading the grid and detail packages; `@object-ui/plugin-detail/core` publishes the detail helpers without registering anything
8+
9+
Clause-②: yes (widening) — one new published `exports` subpath, `@object-ui/plugin-detail/core`, joins what the package accepts; nothing is removed or renamed, and the package root exports the same names as before
10+
Metadata-protocol: none
11+
12+
`@object-ui/plugin-detail` registers its detail and record-page renderers with `ComponentRegistry` when its root entry is evaluated, and the root reaches every detail surface (and, in the console's build, the grid it draws with). A host that imported one pure helper from the root therefore kept the whole package. The package now publishes a `/core` subpath that registers nothing: `isRefusedFeedRead`, `relatedListEntryNames`, `RELATED_ARRANGEMENT_RECORD_VERSION`, `relatedArrangementFromRecord`, `relatedArrangementToRecord`, `deriveFieldGroupDetailSections`, `deriveHighlightFields`, `resolveDetailSections`, `isWideFieldType`, `prefetchRelatedCounts`, `relatedCountTargetsIn`, `COMPACT_RELATED_ROWS`, `normalizeRelatedListSort`, `seedQueueClaimDecision`, `seedRecordFieldAccess`, `seedRecordVerdict`, and the type `RelatedArrangement`.
13+
14+
The same names stay exported from the package root, unchanged; nothing to migrate. The subpath ships ESM only (`import`), as the other `/core` subpaths do. The package's ESM build now emits one file per source module (`dist/index.js`, `dist/core.js` and the modules they import), so the record-page caches a `/core` seed writes are the ones the root's hooks read; the UMD build (`dist/index.umd.cjs`) is unchanged.
15+
16+
The console (`@object-ui/console`, and the shell it draws, `@object-ui/app-shell`) takes these helpers from the subpath, draws the record pointer card's key fields and the approval decision's child tables through `lazy()`, loads the dev-only row-actions page lazily, and registers the tags the grid and detail packages register (`object-grid`, `view:grid`, `detail-view`, `detail-section`, `view:detail`, and the eleven `record:` blocks `details`, `related_list`, `highlights`, `activity`, `chatter`, `discussion`, `path`, `quick_actions`, `history`, `reference_rail`, `alert`) as lazy stubs with the namespaces those registrations declare. Neither package is downloaded on the first load any more; the list and record routes load them with their own route chunks, and any other surface loads them, and registers once, the first time it draws a grid or a detail block. What every page draws is unchanged.

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { DevMasterDetail } from './dev/DevMasterDetail';
2222
import { DevLists } from './dev/DevLists';
2323
import { DevModal } from './dev/DevModal';
2424
import { DevLookup } from './dev/DevLookup';
25-
import { DevRowActions } from './dev/DevRowActions';
2625
import {
2726
AiAddressRedirect,
2827
ConsoleShell,
@@ -102,6 +101,9 @@ const DocPage = lazy(() => import('./pages/DocPage'));
102101
* body loads the chat UI when it first renders.
103102
*/
104103
const SharedRecordPage = lazy(() => import('./pages/SharedRecordPage'));
104+
// Dev-only page drawn with `ObjectGrid`: lazy, so the grid package stays off
105+
// every first load.
106+
const DevRowActions = lazy(() => import('./dev/DevRowActions'));
105107

106108
const SERVER_URL = import.meta.env.VITE_SERVER_URL || '';
107109
const AUTH_URL = `${SERVER_URL}/api/v1/auth`;
@@ -481,7 +483,7 @@ export function App() {
481483
{/* Dev-only: row-action inline-overflow (multiple primary actions). */}
482484
<Route path="/dev/row-actions" element={
483485
<ProtectedRoute>
484-
<DevRowActions />
486+
<Suspense fallback={<LoadingScreen />}><DevRowActions /></Suspense>
485487
</ProtectedRoute>
486488
} />
487489
<Route path="/organizations" element={

‎ui/apps/console/src/register-plugins.ts‎

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525

2626
import { ComponentRegistry } from '@object-ui/core';
2727

28-
// Eager imports — core views the console shell itself imports by name today
29-
// (the shell's own helpers and record surfaces reach these two packages'
30-
// entries), so a lazy stub here would move nothing out of the first load.
31-
import '@object-ui/plugin-grid';
32-
import '@object-ui/plugin-detail';
33-
3428
// Lazy plugins — registered as deferred loaders. The first time the
3529
// SchemaRenderer encounters one of these `type` values, the plugin module is
3630
// imported on-demand (and its top-level `ComponentRegistry.register()` calls
@@ -92,6 +86,55 @@ for (const variant of ['view-switcher', 'filter-ui', 'sort-ui']) {
9286
});
9387
}
9488

89+
// The grid and the detail view: the shell takes the detail helpers from the
90+
// side-effect-free `@object-ui/plugin-detail/core` subpath and draws its few
91+
// detail components behind `lazy()`, and the list and record routes reach both
92+
// entries through their own lazy route chunks, so nothing on the first load
93+
// imports either entry. Each tag the entry registers is a stub with the
94+
// namespace, `skipFallback` and category that registration declares; the first
95+
// schema naming one loads the package, whose own registrations then replace
96+
// every stub of it, once.
97+
ComponentRegistry.registerLazy('object-grid', () => import('@object-ui/plugin-grid'), {
98+
namespace: 'plugin-grid',
99+
category: 'plugin',
100+
});
101+
ComponentRegistry.registerLazy('grid', () => import('@object-ui/plugin-grid'), {
102+
namespace: 'view',
103+
skipFallback: true,
104+
category: 'view',
105+
});
106+
ComponentRegistry.registerLazy('detail-view', () => import('@object-ui/plugin-detail'), {
107+
namespace: 'plugin-detail',
108+
category: 'Views',
109+
});
110+
ComponentRegistry.registerLazy('detail-section', () => import('@object-ui/plugin-detail'), {
111+
namespace: 'plugin-detail',
112+
category: 'Detail Components',
113+
});
114+
ComponentRegistry.registerLazy('detail', () => import('@object-ui/plugin-detail'), {
115+
namespace: 'view',
116+
category: 'view',
117+
});
118+
for (const variant of [
119+
'details',
120+
'related_list',
121+
'highlights',
122+
'activity',
123+
'chatter',
124+
'discussion',
125+
'path',
126+
'quick_actions',
127+
'history',
128+
'reference_rail',
129+
'alert',
130+
]) {
131+
ComponentRegistry.registerLazy(variant, () => import('@object-ui/plugin-detail'), {
132+
namespace: 'record',
133+
skipFallback: true,
134+
category: 'record',
135+
});
136+
}
137+
95138
ComponentRegistry.registerLazy('object-map', () => import('@object-ui/plugin-map'), {
96139
namespace: 'plugin-map',
97140
category: 'view',

‎ui/apps/console/vite.config.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ const workspaceAliases: Record<string, string> = {
627627
// `@object-ui/types/zod` above (objectui#13410).
628628
'@object-ui/plugin-chatbot/core': path.resolve(import.meta.dirname, '../../packages/plugin-chatbot/src/core.ts'),
629629
'@object-ui/plugin-chatbot': path.resolve(import.meta.dirname, '../../packages/plugin-chatbot/src'),
630+
'@object-ui/plugin-detail/core': path.resolve(import.meta.dirname, '../../packages/plugin-detail/src/core.ts'),
630631
'@object-ui/plugin-detail': path.resolve(import.meta.dirname, '../../packages/plugin-detail/src'),
631632
'@object-ui/plugin-editor': path.resolve(import.meta.dirname, '../../packages/plugin-editor/src'),
632633
'@object-ui/plugin-gantt': path.resolve(import.meta.dirname, '../../packages/plugin-gantt/src'),
@@ -1529,7 +1530,8 @@ export default defineConfig({
15291530
// ## The form and view helpers stay out of their plugin chunks
15301531
//
15311532
// The console shell is eager and imports pure helpers through
1532-
// `@object-ui/plugin-form/core` and `@object-ui/plugin-view/core`.
1533+
// `@object-ui/plugin-form/core`, `@object-ui/plugin-view/core` and
1534+
// `@object-ui/plugin-detail/core`.
15331535
// Left to the `plugin-form` / `plugin-view` groups above, those
15341536
// modules would be co-tenants of the renderers and pull each whole
15351537
// chunk back into every first load, the mechanism the chatbot group
@@ -1549,6 +1551,12 @@ export default defineConfig({
15491551
priority: 71,
15501552
includeDependenciesRecursively: false,
15511553
},
1554+
{
1555+
name: 'plugin-detail-core',
1556+
test: /[\\/]packages[\\/]plugin-detail[\\/]src[\\/](core|autoLayout|relatedListCompact|relatedListSort|queueClaim|ConcurrentUpdateDialog|useDetailTranslation|recordFieldAccess|useRecordEditable|useRelatedCounts|renderers[\\/]recordActivityFeed|synth[\\/](relatedListEntry|relatedArrangement|buildDefaultPageSchema))\.tsx?$/,
1557+
priority: 71,
1558+
includeDependenciesRecursively: false,
1559+
},
15521560
//
15531561
// ## The chatbot's side-effect-free half stays out of its chunk (objectui#13410)
15541562
//

‎ui/packages/app-shell/src/__tests__/pluginCoreSubpaths-33581.test.ts‎

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
*/
88

99
/**
10-
* The console shell takes the form and view helpers from the side-effect-free
11-
* `/core` subpaths, never from the package entries (objectstack#33581).
10+
* The console shell takes the form, view and detail helpers from the
11+
* side-effect-free `/core` subpaths, never from the package entries
12+
* (objectstack#33581).
1213
*
13-
* `@object-ui/plugin-form` and `@object-ui/plugin-view` register their
14+
* `@object-ui/plugin-form`, `@object-ui/plugin-view` and
15+
* `@object-ui/plugin-detail` (which reaches `@object-ui/plugin-grid`) register their
1416
* renderers when their entry is evaluated, and each entry reaches every surface
1517
* of its package. A named import of one pure helper from an entry, in any
1618
* module the first load reaches, puts the whole package back into every first
@@ -21,9 +23,10 @@
2123
* - no shell or console source imports, from an entry, a value name its
2224
* `/core` subpath exports (the names are read from the subpath itself, so a
2325
* helper added there is covered the day it is added);
24-
* - the always-eager shell modules that draw a form or a view import nothing
25-
* from either entry by value: their components load through `lazy()`
26-
* (`views/lazyFormSurfaces.tsx`) or through the console's lazy stubs.
26+
* - the always-eager shell modules that draw a form, a view or a detail
27+
* component import nothing from those entries (nor from the grid's) by
28+
* value: their components load through `lazy()` (`views/lazyFormSurfaces.tsx`,
29+
* `views/lazyDetailSurfaces.tsx`) or through the console's lazy stubs.
2730
*
2831
* ⚠ A SOURCE SCAN: it reads import declarations, not the bundle. The built
2932
* graph is the console's `dist/eager-closure.json`; this file keeps the edges
@@ -36,6 +39,7 @@ import path from 'node:path';
3639
import { fileURLToPath } from 'node:url';
3740
import * as formCore from '@object-ui/plugin-form/core';
3841
import * as viewCore from '@object-ui/plugin-view/core';
42+
import * as detailCore from '@object-ui/plugin-detail/core';
3943
// @ts-expect-error — plain-JS shared helper, intentionally untyped (`allowJs: false`)
4044
import { maskComments } from '../../../../scripts/js-comment-mask.mjs';
4145

@@ -48,6 +52,9 @@ const CONSOLE_SRC = path.resolve(here, '../../../../apps/console/src');
4852
const ENTRIES = {
4953
'@object-ui/plugin-form': new Set(Object.keys(formCore)),
5054
'@object-ui/plugin-view': new Set(Object.keys(viewCore)),
55+
'@object-ui/plugin-detail': new Set(Object.keys(detailCore)),
56+
// No `/core` subpath: listed so the eager-module pin below sees its entry.
57+
'@object-ui/plugin-grid': new Set<string>(),
5158
} as const;
5259
type Entry = keyof typeof ENTRIES;
5360

@@ -100,7 +107,7 @@ function entryImports(file: string): EntryImport[] {
100107
const FILES = [...sourceFiles(SHELL_SRC), ...sourceFiles(CONSOLE_SRC)];
101108
const rel = (file: string) => path.relative(path.resolve(here, '../../../..'), file).split(path.sep).join('/');
102109

103-
describe('the form and view helpers come from the /core subpaths (objectstack#33581)', () => {
110+
describe('the form, view and detail helpers come from the /core subpaths (objectstack#33581)', () => {
104111
it('reads real subpaths and a real tree (floors)', () => {
105112
// The helpers the console shell measured on: each subpath must still carry them.
106113
for (const name of ['filterSystemFields', 'isAutoGeneratedFieldType', 'useInitialFieldFocus', 'resolveInlineMode']) {
@@ -109,10 +116,15 @@ describe('the form and view helpers come from the /core subpaths (objectstack#33
109116
for (const name of ['deriveRecordSurface', 'deriveRecordFlowSurface', 'overlayWidthFor', 'toFilterGroup']) {
110117
expect(ENTRIES['@object-ui/plugin-view'].has(name), name).toBe(true);
111118
}
119+
for (const name of ['isRefusedFeedRead', 'relatedListEntryNames', 'seedRecordVerdict', 'relatedCountTargetsIn']) {
120+
expect(ENTRIES['@object-ui/plugin-detail'].has(name), name).toBe(true);
121+
}
112122
expect(FILES.length).toBeGreaterThan(500);
113123
// The scan must see the subpath imports it protects, or it is reading nothing.
114124
const coreImporters = FILES.filter((f) => /from\s*['"]@object-ui\/plugin-(form|view)\/core['"]/.test(readFileSync(f, 'utf8')));
115125
expect(coreImporters.length).toBeGreaterThanOrEqual(10);
126+
const detailCoreImporters = FILES.filter((f) => /from\s*['"]@object-ui\/plugin-detail\/core['"]/.test(readFileSync(f, 'utf8')));
127+
expect(detailCoreImporters.length).toBeGreaterThanOrEqual(9);
116128
});
117129

118130
it('no shell or console source imports a /core helper from a package entry', () => {
@@ -127,7 +139,7 @@ describe('the form and view helpers come from the /core subpaths (objectstack#33
127139
expect(offenders).toEqual([]);
128140
});
129141

130-
it('the always-eager modules that draw a form or a view import neither entry by value', () => {
142+
it('the always-eager modules that draw a form, a view or a detail component import no entry by value', () => {
131143
const EAGER = [
132144
'packages/app-shell/src/console/AppContent.tsx',
133145
'packages/app-shell/src/hooks/useActionModal.tsx',
@@ -139,6 +151,15 @@ describe('the form and view helpers come from the /core subpaths (objectstack#33
139151
'packages/app-shell/src/views/userFilterUrlState.ts',
140152
'apps/console/src/components/FormPage.tsx',
141153
'apps/console/src/register-plugins.ts',
154+
'apps/console/src/App.tsx',
155+
'packages/app-shell/src/hooks/sharedUserFeeds.ts',
156+
'packages/app-shell/src/utils/deriveRelatedLists.ts',
157+
'packages/app-shell/src/utils/workspacePreference.ts',
158+
'packages/app-shell/src/views/recordPagePayload.ts',
159+
'packages/app-shell/src/views/recordDetailSections.ts',
160+
'packages/app-shell/src/views/lazyDetailSurfaces.tsx',
161+
'packages/app-shell/src/views/record-preview/RecordPreviewCard.tsx',
162+
'packages/app-shell/src/views/approval-decision/SubmittedRecord.tsx',
142163
];
143164
const offenders: string[] = [];
144165
for (const r of EAGER) {

‎ui/packages/app-shell/src/hooks/sharedUserFeeds.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ import { usePermissions } from '@object-ui/permissions';
106106
import { errorCodeIs } from '@object-ui/types';
107107
// The refused-read verdict the record activity panel reads (objectui#11195),
108108
// so a refused `sys_activity` read means the same thing on Home (objectui#12843).
109-
import { isRefusedFeedRead } from '@object-ui/plugin-detail';
109+
import { isRefusedFeedRead } from '@object-ui/plugin-detail/core';
110110
// Re-exported from `@object-ui/react` — import it through the provider module
111111
// so a consumer that stubs the provider stubs this too.
112112
import { useAdapter } from '../providers/AdapterProvider.js';

‎ui/packages/app-shell/src/utils/deriveRelatedLists.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ import {
101101
relatedListEntryName,
102102
} from '@objectstack/spec/data';
103103
import { convertSortToQueryParams } from '@object-ui/core';
104-
import { relatedListEntryNames } from '@object-ui/plugin-detail';
104+
import { relatedListEntryNames } from '@object-ui/plugin-detail/core';
105105

106106
/** Audit/ownership FKs that exist on nearly every object — never related lists. */
107107
const AUDIT_FK_FIELDS = new Set(['created_by', 'updated_by', 'owner_id']);

‎ui/packages/app-shell/src/utils/workspacePreference.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
relatedArrangementFromRecord,
1313
relatedArrangementToRecord,
1414
type RelatedArrangement,
15-
} from '@object-ui/plugin-detail';
15+
} from '@object-ui/plugin-detail/core';
1616

1717
/**
1818
* The console's per-reader workspace preferences — how a reader likes the

‎ui/packages/app-shell/src/views/RecordDetailView.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
import { useState, useEffect, useLayoutEffect, useCallback, useContext, useMemo, useRef, type ReactElement } from 'react';
1212
import { useParams, useNavigate, useLocation, useSearchParams, Link } from 'react-router-dom';
13-
import { activityRowToFeedItem, buildCommentThreads, CommentsButton, CommentsPage, RecordCommentsInPanelContext, composeImpersonatedActor, IMPERSONATED_ACTOR_FALLBACK, auditEntriesToFeedItems, bodyTableIdsOf, claimQueuedRecord, RECORD_PAGE_TIMELINE_PANEL, RECORD_TIMELINE_PANEL_MAX_ENTRIES, RecordFieldChangesContext, RecordFieldHistoryContext, RecordTimelineTotalContext, DefaultRecordPageContext, EMPTY_RELATED_ARRANGEMENT, InlineEditSaveBar, RECORD_PAGE_DETAILS_WIDTH, RecordBodyTablesContext, RecordMetaFooter, RecordPageColumns, buildDefaultPageColumns, buildDefaultPageSchema, extractMentions, isRefusedFeedRead, recordSitsInQueue, resolveTitleField, useQueueClaimOffered, useRecordEditable, useRecordPageTier } from '@object-ui/plugin-detail';
13+
import { activityRowToFeedItem, buildCommentThreads, CommentsButton, CommentsPage, RecordCommentsInPanelContext, composeImpersonatedActor, IMPERSONATED_ACTOR_FALLBACK, auditEntriesToFeedItems, bodyTableIdsOf, claimQueuedRecord, RECORD_PAGE_TIMELINE_PANEL, RECORD_TIMELINE_PANEL_MAX_ENTRIES, RecordFieldChangesContext, RecordFieldHistoryContext, RecordTimelineTotalContext, DefaultRecordPageContext, EMPTY_RELATED_ARRANGEMENT, InlineEditSaveBar, RECORD_PAGE_DETAILS_WIDTH, RecordBodyTablesContext, RecordMetaFooter, RecordPageColumns, buildDefaultPageColumns, buildDefaultPageSchema, extractMentions, recordSitsInQueue, resolveTitleField, useQueueClaimOffered, useRecordEditable, useRecordPageTier } from '@object-ui/plugin-detail';
14+
import { isRefusedFeedRead } from '@object-ui/plugin-detail/core';
1415
// objectstack#36075 — the comment panel's unresolved count and the moderator's verdict.
1516
import { unresolvedThreadCount, useRecordVerdict } from '@object-ui/plugin-detail';
1617
import { Empty, EmptyTitle, EmptyDescription, Button, PageHeaderActions, PageHeaderPhoneContext, PageHeaderTrailingContext, PanelToggles, ObjectIconTile, RecordHeaderBarContext, RecordHeaderStateContext, RecordTopBar, RecordTopBarButton, cn, useRecordStepKeys, type PanelToggleItem, type RecordHeaderBar, type RecordHeaderGroupParts, type RecordHeaderState, type RecordTopBarStepper } from '@object-ui/components';

‎ui/packages/app-shell/src/views/approval-decision/SubmittedRecord.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ import { isDeadlineSettled, withoutDeniedFields } from '@object-ui/core';
9696
import { getCellRenderer, resolveCellRendererType } from '@object-ui/fields';
9797
import { useSafeFieldLabel } from '@object-ui/i18n';
9898
import { usePermissions } from '@object-ui/permissions';
99-
import { deriveFieldGroupDetailSections, isWideFieldType, RelatedList } from '@object-ui/plugin-detail';
99+
import { deriveFieldGroupDetailSections, isWideFieldType } from '@object-ui/plugin-detail/core';
100100
import {
101101
useAdapter,
102102
useDataInvalidation,
@@ -112,6 +112,7 @@ import { deriveRecordDetailSections } from '../recordDetailSections.js';
112112
import { deriveRelatedLists } from '../../utils/deriveRelatedLists.js';
113113
import { servedObjectLabel, servedObjectPluralLabel } from '../../hooks/servedObjectLabel.js';
114114
import { useReportRecordRead } from './recordReadReport.js';
115+
import { LazyRelatedList } from '../lazyDetailSurfaces.js';
115116
import {
116117
distinctLabels,
117118
planSubmittedRecord,
@@ -608,7 +609,7 @@ export function SubmittedChildTables({ model, className }: { model: SubmittedRec
608609
data-submitted-child={relation.childObject}
609610
>
610611
<p className="mb-2 text-xs text-muted-foreground" data-submitted-child-note>{note}</p>
611-
<RelatedList
612+
<LazyRelatedList
612613
title={title}
613614
type="table"
614615
api={relation.childObject}

0 commit comments

Comments
 (0)