1515 * metadata type.
1616 */
1717
18- import { lazy , Suspense , type ComponentType } from 'react' ;
18+ import { lazy , Suspense } from 'react' ;
1919import { registerAppComponent } from './componentRegistry.js' ;
20+ import { lazyPage , LazyPageFallback as MetadataAdminFallback } from './lazyPage.js' ;
2021import { registerMetadataResource } from '../views/metadata-admin/registry.js' ;
21- import { PositionGrantedSetsCell , PositionHolderCountCell } from '../views/metadata-admin/PositionGrantCells.js' ;
2222import { CONNECTOR_CREDENTIALS_REF } from '../views/setup/connectorCredentials.js' ;
2323import { CONNECTOR_CONNECTIONS_REF } from '../views/setup/connectorConnections.js' ;
2424import { PERMISSION_SET_ASSIGNMENT_REF , POSITION_HOLDERS_REF } from '../views/setup/peopleAssignments.js' ;
@@ -94,42 +94,22 @@ const MetadataResourceRouter = lazy(() =>
9494 import ( '../views/metadata-admin/index.js' ) . then ( ( m ) => ( { default : m . MetadataResourceRouter } ) ) ,
9595) ;
9696
97- function MetadataAdminFallback ( { label } : { label : string } ) {
98- return < div className = "p-6 text-sm text-muted-foreground" > Loading { label } …</ div > ;
99- }
100-
10197/**
102- * A page registered BY REFERENCE to its module, loaded the first time it is
103- * drawn (objectstack#33293). Every page below was imported here by value, and
104- * this module is a side-effect import of the package entry, so each one, with
105- * everything it imports, was in the console's EAGER closure: on a dashboard
106- * route the browser downloaded the Packages page, its package form dialog, the
107- * permission-matrix editor and the Setup assignment pages before it asked for
108- * data. Measured from `apps/console/dist/eager-closure.json` and the emitted
109- * chunks' module lists, not from a source search (see the trap above): with
110- * these registrations lazy, the `PackageFormDialog` and
111- * `PositionHoldersSection` chunks leave the closure.
98+ * Pages registered BY REFERENCE to their module, loaded the first time they are
99+ * drawn (objectstack#33293), through the one wrapper `./lazyPage.tsx`, whose
100+ * header says why. Every page below was imported here by value, and this module
101+ * is a side-effect import of the package entry, so each one, with everything it
102+ * imports, was in the console's EAGER closure: on a dashboard route the browser
103+ * downloaded the Packages page, its package form dialog, the permission-matrix
104+ * editor and the Setup assignment pages before it asked for data. Measured from
105+ * `apps/console/dist/eager-closure.json` and the emitted chunks' module lists,
106+ * not from a source search (see the trap above): with these registrations lazy,
107+ * the `PackageFormDialog` and `PositionHoldersSection` chunks leave the closure.
112108 *
113- * The same shape as the two registrations above: the `Suspense` boundary lives
114- * inside the registered value, so `registerAppComponent` and
115- * `registerMetadataResource` still receive a component, and no render site
116- * learns about pending. ⛔ It only defers anything while nothing else in the
117- * package's eager graph names the page module statically; the barrel's
118- * `PackagedActionsPage` re-export is tree-shaken today because the console
119- * imports no such name.
109+ * ⛔ It only defers anything while nothing else in the package's eager graph
110+ * names the page module statically; the barrel's `PackagedActionsPage`
111+ * re-export is tree-shaken today because the console imports no such name.
120112 */
121- function lazyPage < P extends object > ( label : string , load : ( ) => Promise < ComponentType < P > > ) : ComponentType < P > {
122- const Page = lazy ( ( ) => load ( ) . then ( ( component ) => ( { default : component } ) ) ) ;
123- function LazyPage ( props : P ) {
124- return (
125- < Suspense fallback = { < MetadataAdminFallback label = { label } /> } >
126- < Page { ...props } />
127- </ Suspense >
128- ) ;
129- }
130- return LazyPage ;
131- }
132-
133113const PackagesPage = lazyPage ( 'packages' , ( ) =>
134114 import ( '../views/metadata-admin/PackagesPage.js' ) . then ( ( m ) => m . PackagesPage ) ,
135115) ;
@@ -154,6 +134,20 @@ const PermissionSetAssignmentPage = lazyPage('permission set assignments', () =>
154134const RecycleBinPage = lazyPage ( 'recycle bin' , ( ) =>
155135 import ( '../views/setup/RecycleBinPage.js' ) . then ( ( m ) => m . RecycleBinPage ) ,
156136) ;
137+ /**
138+ * The position list's two served cells (objectstack#33582): by value they held
139+ * `metadata-admin/i18n.ts`, and with it the Studio `en` string namespace, in the
140+ * eager closure. A cell draws nothing until its module lands (no page-sized
141+ * loading line inside a table cell); every cell shares the one load.
142+ */
143+ const PositionHolderCountCell = lazyPage ( 'position holders' , ( ) =>
144+ import ( '../views/metadata-admin/PositionGrantCells.js' ) . then ( ( m ) => m . PositionHolderCountCell ) ,
145+ null ,
146+ ) ;
147+ const PositionGrantedSetsCell = lazyPage ( 'position permission sets' , ( ) =>
148+ import ( '../views/metadata-admin/PositionGrantCells.js' ) . then ( ( m ) => m . PositionGrantedSetsCell ) ,
149+ null ,
150+ ) ;
157151
158152/**
159153 * The Suspense boundary lives INSIDE the registration value, which is the shape
0 commit comments