Skip to content

finding(console): ~194 KB gzipped of AppContent's OTHER lazy() declarations is eager too -- metadata-admin alone is 181 KB, 6x today's headroom #6681

Description

@claude

Found while implementing objectui#6535. Filed unassigned, recording only. Observational: nothing is broken.

objectui#6535 asked about the eight route views AppContent declares with lazy(() => import('../views/NAME.js')). While measuring those, the same read of apps/console/dist/eager-closure.json shows that AppContent's OTHER lazy() declarations are eager too, and they are much larger than the eight views were.

Measured on ece68882 plus objectui#6535's branch (files[] IS the eager set, 49 of 508 chunks):

chunkdeclared in AppContent.tsx asgzipped, eager
metadata-adminsix lazy() pages (MetadataDirectoryPage, StudioHomePage, MetadataResourceListPage, MetadataResourceEditPage, MetadataResourceHistoryPage, MetadataDiagnosticsPage)181,228 B
MarketplacePackagePagelazy()7,672 B
MarketplacePagelazy()3,129 B
MarketplaceInstalledPagelazy()1,842 B

That is ~193.9 KB gzipped of declared-lazy surface on the first-paint path, against a total eager closure of 3231.7 KB and a ceiling of 3266.6 KB -- i.e. roughly 5.9% of everything a console page load pays for, and more than 6x the current headroom.

For scale: the eight views objectui#6535 was filed about were worth 5.3 KB once freed. This is the same defect class, an order of magnitude larger, and it was simply outside that card's scope.

Why it is separate from objectui#6535

objectui#6535's scope was the eight single-file route views, and its repair (scripts/vite-declared-lazy-views.ts) deliberately parses ONLY the ../views/NAME.js specifiers. Widening that ledger to a directory barrel (../views/metadata-admin/index.js), a sibling directory (./marketplace/*.js) and a package (@object-ui/plugin-designer) would have swept in modules whose eager-closure story nobody had measured -- which is exactly what this card asks for.

The mechanism is very likely NOT the same one objectui#6535 fixed. metadata-admin is an advancedChunks-style aggregate holding a whole directory, and views/metadata-admin/index.ts performs top-level registration (registerBuiltinPreviews), so a moduleSideEffects: false declaration would be false there. Measure before assuming.

What this card does NOT claim

  • Not a budget regression -- pnpm check:eager-closure PASSES today.
  • Not that these should simply be deleted or made side-effect-free. views/metadata-admin/index.ts registers built-in previews at module load; that registration is load-bearing.

Suggested shape, if graded

For each of the four, find the static edge into the eager closure the way objectui#6535 did -- the emitted chunk's own module list, not a source-level search (see objectui#6680 for why the source graph is not enough). Then decide per chunk whether the edge is removable. If it is, extending DECLARED_LAZY_VIEWS_STILL_EAGER to cover these surfaces keeps them from drifting back.

Related

  • objectui#6535 -- the card this was found under; the same measurement, narrower scope.
  • objectui#6680 -- chunk co-tenancy, the mechanism that defeated two of objectui#6535's views.
  • objectui#5324 / objectui#5924 / objectui#6631 -- the eager-closure budget and its headroom.

Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:queuepriority:p1

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions