Repository navigation
perf(ui): Shrink the consumer plugin's render path and check the plugins in CI - #606
Merged
Merged
Conversation
Nothing parsed with the Zod schemas; adapter.ts builds every value and only the inferred types were used. Declaring them as plain types keeps zod (~360KB unminified) out of the chunk every page loads.
Pin datum-ui (3.6.0) and react-query (5.102.8) to the versions cloud-portal resolves: the host's copies are what run, so the local ones should type-check against the same APIs. Take patch and minor updates elsewhere, keep motion below 14 (datum-ui's peer range), and drop zod, which nothing imports now.
The portal downloads and parses every page's chunks on first visit. Minifying cuts the bundle from ~6.0MB to ~2.5MB (~1.3MB to ~0.75MB gzipped); source maps keep it readable in devtools.
The portal's asset proxy serves remoteEntry.js and the manifests as no-cache and forwards the browser's validators, but serve.ts sent none, so every page load downloaded them again. Send a weak ETag and Last-Modified and answer a match with 304.
Describe the datum-ui subpaths shared from the host, the rule for pinning host-provided packages, serving and caching, and the current file layout.
publish.yaml only builds the plugin images, so neither plugin's typecheck nor the consumer's unit tests ever ran in CI.
ecv
approved these changes
Nov 3, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
Minification, source maps, ETag support and the Zod removal are safe at the head, and the module-federation sharing is unchanged by this PR.
sharedinui/consumer/vite.config.tsis untouched: react, react-dom, react-router and react-query stay singletons with host-majorrequiredVersion, and the datum-ui subpaths stayrequiredVersion: false, so the host's copy wins and no second React loads. The bumps (datum-ui 3.6.0, react-query 5.102.8) only change the local install; I could not confirm them against cloud-portal's lockfile from here.schema.tskeeps every field of both resources..default([])becomes a required array anddeletinga required boolean, which is safe only becauseadapter.tsbuilds every value, andtsc --noEmitpasses in the new job. No remainingzodor*Schemaimports anywhere inui/consumer/src.serve.tsadds onlyETag/Last-Modifiedand 304 handling; no CORS or other header changes..mapwas already in the MIME table, so maps are served fromdist/to anyone who can reach the portal's asset proxy.ui/provideralready shipssourcemap: true, so this matches existing practice; just confirm that exposing readable source is intended for the consumer plugin.ui-plugins.ymlrunsnpm ci,typecheckand (consumer only)vitestfor both plugins, with least-privilegepermissions: contents: read. Actions are pinned to major tags (actions/checkout@v7,setup-node@v7), consistent with the repo's other workflows rather than SHAs.
Follow-ups:
- The new workflow typechecks but never runs
vite build. The build (and so the minify and module-federation chunking change) is only exercised by the image publish jobs, so a build-only break is caught after the fact. Addingnpm run buildto the matrix would close that. - Minifying a module-federation remote changes chunk shapes, so check the portal in staging with a real plugin load (not just a green build) before it reaches production.
6 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cuts what the cloud portal downloads to render the compute consumer plugin by about two thirds per page, aligns the plugin's dependencies with the host, and adds the CI checks the plugins never had.
minify: falseshipped every chunk unminified. Source maps keep it readable in devtools.schema.tsbuilt Zod schemas that nothing parsed with —adapter.tsbuilds every value and only the inferred types were used. They are now plain interfaces of the same shape, which takes zod (~360KB unminified) out of the chunk every page loads.serve.ts. The portal's asset proxy servesremoteEntry.jsand the manifests asno-cacheand forwards the browser's validators, butserve.tssent none, so every page load downloaded them in full. It now sends a weakETagandLast-Modifiedand answers aGET/HEADmatch with304.serve.tsis now part of the plugin's typecheck.UI Pluginsworkflow typechecksui/consumerandui/providerand runs the consumer's unit tests on changes underui/. Until nowpublish.yamlonly built the images.First-load JS per page
Sync chunks per exposed module, from
mf-manifest.json(an upper bound: it includes fallback copies of host-shared packages, which the portal doesn't load).WorkloadListWorkloadDetailInstanceDetailInstanceShellWindowWorkloadsHomeColumnremoteEntry.js304on revalidationVerification
npm run typecheck,npm test(21 files, 353 tests) andnpm run buildpass inui/consumer.npm ci --ignore-scripts, typecheck, tests) pass on clean copies ofui/consumerandui/providerwithoutnode_modules; the workflow passes a YAML lint.serve.tsexercised over TLS against the builtdist/: a matchingIf-None-Matchreturns304with no body, a stale one returns200, a staleIf-None-Matchwith a validIf-Modified-Sincereturns200,If-Modified-Sincealone returns304,HEADreturns200(and304on a match), a conditionalPOSTgets no304, and path traversal still returns404.tsc(assignable both ways, same optionality), confirmed zod is absent from the build output, and confirmed the shared packages match cloud-portal's resolved versions.immutablecaching; a source change that minifies to identical output keeps the chunk's name, so devtools could show a stale map. Runtime is unaffected.Follow-ups
@vitejs/plugin-react6.