Repository navigation
Load block source only when its Code panel opens - #62
Open
Floating-Y wants to merge 1 commit into
Open
Floating-Y wants to merge 1 commit into
Floating-Y wants to merge 1 commit into
Conversation
Signed-off-by: danwood <118035379+Floating-Y@users.noreply.github.com>
Floating-Y
marked this pull request as ready for review
October 26, 2026 13:38
This branch has not been deployed
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.
Opening a standalone Block preview still imports every Block's raw source and transforms the entire registry, even before Code is opened.
Keep the literal metadata registry and lazy preview components lightweight. Import a separate source module only when Code opens, then load and transform that Block's files and required shared overview. Cache in-flight and successful results; remove failed requests from the cache. The Code panel shows loading/error/retry feedback and ignores results after unmount. File selection survives Preview → Code.
Preserves page-first order, displayed paths, copied contents, shared overview and its note, import rewriting, page metadata-export cleanup, preview behavior and install commands. No dependency or general loading framework added. Metadata parsing and registry generation remain unchanged.
Based on upstream dev
daa7cf1in a separate worktree; the original local route-loading branch was untouched. Checked upstream PRs: #59 separates the preview route; #32/#33 cover rewriting and metadata. None removes this eager source loading.Validation
Ubuntu CI web passed for commit
082d943: locked install, both regression suites, unmodified docs generation, registry consistency, typecheck and production build.node --test scripts/block-metadata.test.mjs: 8 passed.node --test scripts/block-sources.test.mjs: 4 passed. Executes real transpiled modules with mocked Vite glob boundaries; covers preview without source imports, selected Block/shared files, order/paths/transformations, own Block paths, concurrent/success reuse, failure and retry. Added to existing CI.npm run typecheck: passed.Docs/registry generation and production build passed with temporary Windows adaptations described below. Direct
node node_modules/vite/bin/vite.js build --manifestpassed too.registry.json, build scripts, dependencies and lockfile have no changes. Full diff andgit diff --checkreviewed. Commit is DCO signed off.Production browser evidence
Served production files from fresh localhost origins with
Cache-Control: no-store; recorded server requests and mapped built URLs through Vite's manifest./view/sidebar-07and initial/blocks: 0 Block raw-source requests and 0 source-loader requests.shared/overview.tsx; no other Block source.These are dependency/request observations, not measured compressed-transfer or load-time savings. No source-text byte total is presented as network savings.
Local Windows limitation
Unmodified
npm run docsandnpm run buildwere run and fail in the existing documentation generator on Windows/Node 22.15.0: CRLF heading parsing, then Windows paths producing an invalid slug. Registry generation also needs a Windows-compatible npx invocation.For local generation/build verification only, normalized MDX line endings, temporarily normalized the slug path separator and invoked
npx.cmdwith a shell. Both script adaptations and content changes were restored before committing. This does not claim that the unmodified standard build passes locally; The Ubuntu CI run linked above passed the unmodified standard commands.Firefox/Safari, physical devices, deployed compression and a before/after transfer benchmark were not tested. Do not auto-merge.