perf(bundle): stop three routes shipping the block and tool registries - #6138
Conversation
The public /integrations page downloaded, parsed and executed 19.54 MB of JavaScript, 15.52 MB of which was the tool registry — 4,351 tool configs, to render a catalog of names and icons. It arrived as `<script async>` in the initial HTML, so the browser fetched and ran it on load. Measured on a production build, chunks referenced by the page's own HTML: /integrations 19.54 MB -> 3.55 MB across 41 chunks (-82%) No chunk over 1 MB remains on that route. credit-usage also loses its copy. Three separate import edges, all the same shape: a module mixing pure helpers with registry-backed ones, so importing the pure half dragged in all 282 block configs and the tool registry behind them. - `lib/integrations/index.ts` built POPULAR_WORKFLOWS at module scope via `getAllBlockMeta()` and re-exported registry functions. The landing grid is a client component, so importing anything from that barrel inherited the whole graph. POPULAR_WORKFLOWS moves to its own module — its one real consumer is a server page — and the re-export goes, which .claude/rules/sim-imports.md already forbids and which nothing imported through the barrel. - `blocks/icon-color.ts` mixed pure contrast maths (`getTileIconColorClass`, `isLightTileColor`, used by the landing page) with `getBareIconStyle`, which reads `getAllBlocks()`. Split by dependency into `blocks/brand-icon-style.ts`; all six of its consumers are under app/workspace/** where the registry is already legitimately present. - `credit-usage-view.tsx` imported a date formatter from the logs feature's `utils.ts`, which also exports registry-backed badge components. `formatDateShort` has three consumers across three features, so it moves to `lib/core/utils/date-display.ts` per the repo's utils-location rule. Not addressed: account/settings/[section] still reaches the registry through workspace-permissions-provider -> socket-provider, one of the four known client edges from the module-graph audit rather than a stray import. It is also loaded via `dynamic()`, so it is likely lazy rather than on first paint. That belongs with the registry split, not here. workspace/* keeps its copy, which is correct — the editor needs tool params and outputs.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Integrations catalog: Icon styling: Dates: Workspace code that legitimately needs the registry still imports Reviewed by Cursor Bugbot for commit 691912b. Configure here. |
Greptile SummaryThis PR separates registry-backed utilities from lightweight modules to reduce route-specific client bundles.
Confidence Score: 5/5The PR appears safe to merge, with the utility relocations preserving existing behavior while removing unintended registry dependencies. All removed exports have migrated consumers, the popular-workflow registry access remains confined to a server component, and the extracted icon and date helpers preserve their previous implementations without introducing unresolved imports or runtime-boundary issues.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/integrations/index.ts | Removes registry-backed workflow derivation and registry re-exports from the lightweight integrations barrel without leaving unresolved consumers. |
| apps/sim/lib/integrations/popular-workflows.ts | Preserves popular-workflow derivation in a dedicated module consumed only by the server-rendered integrations page. |
| apps/sim/blocks/brand-icon-style.ts | Relocates the existing registry-backed icon styling implementation while preserving its behavior and updating all consumers. |
| apps/sim/blocks/icon-color.ts | Retains only pure contrast helpers, severing the block-registry dependency from lightweight callers. |
| apps/sim/lib/core/utils/date-display.ts | Relocates the compact date formatter unchanged into a dependency-free shared utility and updates all known consumers. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Landing["/integrations client UI"] --> Catalog["Lightweight integrations catalog"]
Landing --> Colors["Pure icon-color helpers"]
ServerPage["/integrations server page"] --> Popular["Popular workflows"]
Popular --> BlockRegistry["Block registry"]
Workspace["Workspace routes"] --> BrandStyle["Brand icon styling"]
BrandStyle --> BlockRegistry
Logs["Logs / credit usage / audit logs"] --> Dates["Pure date-display helper"]
BlockRegistry --> ToolRegistry["Tool registry"]
Reviews (1): Last reviewed commit: "perf(bundle): stop three routes shipping..." | Re-trigger Greptile
Summary
The public
/integrationspage downloaded, parsed and executed 19.54 MB of JavaScript, 15.52 MB of it the tool registry — 4,351 tool configs, to render a catalog of names and icons. It arrived as<script async>in the initial HTML, so the browser fetched and ran it on load./integrations−82%.
credit-usageloses its copy too. Measured from production builds, counting the chunks each page's own HTML references.Three edges, one shape
Every case is a module mixing pure helpers with registry-backed ones, so importing the pure half dragged in all 282 block configs and the tool registry behind them.
1.
lib/integrations/index.tsbuiltPOPULAR_WORKFLOWSat module scope viagetAllBlockMeta(), and re-exported registry functions. The landing grid is a'use client'component, so importing anything from that barrel inherited the whole graph.POPULAR_WORKFLOWSmoves to its own module — its one real consumer is a server page — and the re-export goes, which.claude/rules/sim-imports.mdalready forbids and which nothing imported through the barrel anyway.2.
blocks/icon-color.tsmixed pure contrast maths (getTileIconColorClass,isLightTileColor— what the landing page uses) withgetBareIconStyle, which readsgetAllBlocks(). Split by dependency intoblocks/brand-icon-style.ts. All sixgetBareIconStyleconsumers are underapp/workspace/**, where the registry is already legitimately present.3.
credit-usage-view.tsximported a date formatter from the logs feature'sutils.ts, which also exports registry-backed badge components.formatDateShorthas three consumers across three features (logs, credit-usage, audit-logs), so it moves tolib/core/utils/date-display.tsper the repo's utils-location rule.No codegen, no async refactor, no dynamic imports — just severing import edges that shouldn't have existed.
Deliberately not fixed here
account/settings/[section]still reaches the registry, but throughworkspace-permissions-provider→socket-provider— one of the four known client edges from the module-graph audit, not a stray import. It's also loaded viadynamic(), so it's likely lazy rather than on first paint. That belongs with the registry split.workspace/*keeps its copy, which is correct — the editor genuinely needs toolparamsandoutputs.A measurement note worth recording
My first check used total client JS (110.08 MB → 110.04 MB) and looked like a total failure. That was the wrong instrument: total sums every route, and this is a per-route fix — the registry still ships to
workspace/*by design. Measuring the page's own referenced chunks showed the 82% drop. Worth remembering before anyone concludes a route-scoped change "did nothing".Type of Change
Testing
tsc --noEmitclean (one pre-existingtrigger.config.tsnode-24 error on staging, untouched here)biome checkcleanblocks,lib/integrations,lib/core/utils'use client'directives remain the first statement in their files after the import moves