From 2b3e3145561c38ff5a1ff7671b862c98ed34b4ca Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 00:45:48 +0000 Subject: [PATCH 1/2] perf(console): load the Setup pages and the view config panel on demand The Setup and metadata pages registered in builtinComponents.tsx were imported by value, and ObjectView imported ViewConfigPanel statically, so the Packages page, its form dialog, the permission-matrix editor, SchemaForm and the Studio form widgets were all in the console's eager closure on every route. Each now loads behind lazy() with its Suspense boundary inside the registered value or around the panel. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5mmCUzPNeT1C9cHRtT --- .../src/services/builtinComponents.tsx | 67 ++++++++++++++++--- .../app-shell/src/views/ObjectView.tsx | 39 ++++++----- 2 files changed, 82 insertions(+), 24 deletions(-) diff --git a/ui/packages/app-shell/src/services/builtinComponents.tsx b/ui/packages/app-shell/src/services/builtinComponents.tsx index cf4a3d4108e..ec73e832d58 100644 --- a/ui/packages/app-shell/src/services/builtinComponents.tsx +++ b/ui/packages/app-shell/src/services/builtinComponents.tsx @@ -15,21 +15,13 @@ * metadata type. */ -import { lazy, Suspense } from 'react'; +import { lazy, Suspense, type ComponentType } from 'react'; import { registerAppComponent } from './componentRegistry.js'; import { registerMetadataResource } from '../views/metadata-admin/registry.js'; -import { PermissionMatrixEditPage } from '../views/metadata-admin/PermissionMatrixEditor.js'; -import { PackagesPage } from '../views/metadata-admin/PackagesPage.js'; import { PositionGrantedSetsCell, PositionHolderCountCell } from '../views/metadata-admin/PositionGrantCells.js'; -import { PackagedActionsPage } from '../views/setup/PackagedActionsPage.js'; -import { ConnectorCredentialsPage } from '../views/setup/ConnectorCredentialsPage.js'; import { CONNECTOR_CREDENTIALS_REF } from '../views/setup/connectorCredentials.js'; -import { ConnectorConnectionsPage } from '../views/setup/ConnectorConnectionsPage.js'; import { CONNECTOR_CONNECTIONS_REF } from '../views/setup/connectorConnections.js'; -import { PositionHoldersPage } from '../views/setup/PositionHoldersPage.js'; -import { PermissionSetAssignmentPage } from '../views/setup/PermissionSetAssignmentPage.js'; import { PERMISSION_SET_ASSIGNMENT_REF, POSITION_HOLDERS_REF } from '../views/setup/peopleAssignments.js'; -import { RecycleBinPage } from '../views/setup/RecycleBinPage.js'; import { RECYCLE_BIN_REF } from '../views/setup/recycleBin.js'; import { isAggregatedViewContainer, @@ -106,6 +98,63 @@ function MetadataAdminFallback({ label }: { label: string }) { return
Loading {label}…
; } +/** + * A page registered BY REFERENCE to its module, loaded the first time it is + * drawn (objectstack#33293). Every page below was imported here by value, and + * this module is a side-effect import of the package entry, so each one, with + * everything it imports, was in the console's EAGER closure: on a dashboard + * route the browser downloaded the Packages page, its package form dialog, the + * permission-matrix editor and the Setup assignment pages before it asked for + * data. Measured from `apps/console/dist/eager-closure.json` and the emitted + * chunks' module lists, not from a source search (see the trap above): with + * these registrations lazy, the `PackageFormDialog` and + * `PositionHoldersSection` chunks leave the closure. + * + * The same shape as the two registrations above: the `Suspense` boundary lives + * inside the registered value, so `registerAppComponent` and + * `registerMetadataResource` still receive a component, and no render site + * learns about pending. ⛔ It only defers anything while nothing else in the + * package's eager graph names the page module statically; the barrel's + * `PackagedActionsPage` re-export is tree-shaken today because the console + * imports no such name. + */ +function lazyPage

(label: string, load: () => Promise>): ComponentType

{ + const Page = lazy(() => load().then((component) => ({ default: component }))); + function LazyPage(props: P) { + return ( + }> + + + ); + } + return LazyPage; +} + +const PackagesPage = lazyPage('packages', () => + import('../views/metadata-admin/PackagesPage.js').then((m) => m.PackagesPage), +); +const PermissionMatrixEditPage = lazyPage('permission set', () => + import('../views/metadata-admin/PermissionMatrixEditor.js').then((m) => m.PermissionMatrixEditPage), +); +const PackagedActionsPage = lazyPage('packaged actions', () => + import('../views/setup/PackagedActionsPage.js').then((m) => m.PackagedActionsPage), +); +const ConnectorCredentialsPage = lazyPage('connector credentials', () => + import('../views/setup/ConnectorCredentialsPage.js').then((m) => m.ConnectorCredentialsPage), +); +const ConnectorConnectionsPage = lazyPage('connector connections', () => + import('../views/setup/ConnectorConnectionsPage.js').then((m) => m.ConnectorConnectionsPage), +); +const PositionHoldersPage = lazyPage('position holders', () => + import('../views/setup/PositionHoldersPage.js').then((m) => m.PositionHoldersPage), +); +const PermissionSetAssignmentPage = lazyPage('permission set assignments', () => + import('../views/setup/PermissionSetAssignmentPage.js').then((m) => m.PermissionSetAssignmentPage), +); +const RecycleBinPage = lazyPage('recycle bin', () => + import('../views/setup/RecycleBinPage.js').then((m) => m.RecycleBinPage), +); + /** * The Suspense boundary lives INSIDE the registration value, which is the shape * every other lazy `registerAppComponent` entry already uses diff --git a/ui/packages/app-shell/src/views/ObjectView.tsx b/ui/packages/app-shell/src/views/ObjectView.tsx index 02bdbb6ab07..1ae89a37cbd 100644 --- a/ui/packages/app-shell/src/views/ObjectView.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.tsx @@ -28,7 +28,14 @@ import { useServedViewItems } from '../hooks/useServedViewItems.js'; import { servedObjectLabel, servedObjectPluralLabel } from '../hooks/servedObjectLabel.js'; import type { DataSource } from '@object-ui/types'; import { MetadataPanel, useMetadataInspector } from './MetadataInspector.js'; -import { ViewConfigPanel } from './ViewConfigPanel.js'; +// objectstack#33293: the view config panel loads with the first list, not with +// the console. Statically, it held the view-variant inspector, `SchemaForm` and +// the Studio form widgets in the EAGER closure, so a dashboard route downloaded +// them too. It is drawn on every list (closed, it draws nothing), so its chunk +// is fetched as the list mounts, before any admin can open it. +const ViewConfigPanel = lazy(() => + import('./ViewConfigPanel.js').then((m) => ({ default: m.ViewConfigPanel })), +); import { useMetadataClient } from './metadata-admin/useMetadata.js'; import { dropPublishedViewList } from './metadata-admin/viewListDrop.js'; import { CreateViewDialog } from './CreateViewDialog.js'; @@ -1369,20 +1376,22 @@ function ObjectViewInner({ dataSource, objects, onEdit, externalRefreshKey }: Co showViewConfigPanel && isAdmin ? 'max-w-[280px] opacity-100' : 'max-w-0 opacity-0' }`} > - { setShowViewConfigPanel(false); setViewConfigPanelMode('edit'); }} - mode={viewConfigPanelMode} - activeView={activeView} - objectDef={objectDef} - recordCount={recordCount} - onSave={handleViewConfigSave} - onViewUpdate={handleViewUpdate} - onCreate={handleViewCreate} - metadataClient={metadataClient} - dataSource={dataSource} - onAfterChange={() => setRefreshKey(k => k + 1)} - /> + + { setShowViewConfigPanel(false); setViewConfigPanelMode('edit'); }} + mode={viewConfigPanelMode} + activeView={activeView} + objectDef={objectDef} + recordCount={recordCount} + onSave={handleViewConfigSave} + onViewUpdate={handleViewUpdate} + onCreate={handleViewCreate} + metadataClient={metadataClient} + dataSource={dataSource} + onAfterChange={() => setRefreshKey(k => k + 1)} + /> + Date: Sun, 15 Nov 2026 00:47:52 +0000 Subject: [PATCH 2/2] chore(changeset): console eager closure drops the Setup pages and view config panel Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5mmCUzPNeT1C9cHRtT --- .changeset/33293-console-eager-closure-setup-pages.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/33293-console-eager-closure-setup-pages.md diff --git a/.changeset/33293-console-eager-closure-setup-pages.md b/.changeset/33293-console-eager-closure-setup-pages.md new file mode 100644 index 00000000000..3f22de2ec32 --- /dev/null +++ b/.changeset/33293-console-eager-closure-setup-pages.md @@ -0,0 +1,10 @@ +--- +'@object-ui/console': patch +--- + +perf(console): the first load no longer downloads the Setup pages, the package form and the view config panel + +Clause-②: no +Metadata-protocol: none + +Every Console route, a dashboard included, used to download the Packages page with its package form dialog, the permission-set editor, the Setup pages for packaged actions, connector credentials, connector connections, position holders, permission-set assignment and the recycle bin, and the list view's config panel with the Studio form widgets it draws, before the app asked for any data. These now load the first time they are drawn: a Setup page when its entry is opened, the view config panel as a list mounts. The Console's eager closure (`dist/eager-closure.json`) goes from 2,293,387 to 2,163,688 bytes gzipped (−129,699), measured on two builds of the same tree. What each route draws is unchanged; a Setup page shows a one-line loading notice while its code arrives.