Repository navigation
Re-render only pages affected by header, footer and navigation edits, serve stale dev pages fresh. - #9
Merged
Conversation
… serve stale dev pages fresh.
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
Editing a header, footer or navigation file in
servenow re-renders only the pages it affects, and the browser always gets the fresh page on reload. Previously, a header or footer edit threw away the builder and rendered every page. After that, the dev server could keep showing stale pages.Changes
Header and footer edits no longer rebuild everything
An edit, addition or deletion of a
header.mdxorfooter.mdxrecompiles the partials and marks only the pages whose nearest header or footer HTML actually changed. Editingguides/header.mdxtouchesguides/pages, notcomponents/, and not a subfolder with its own header. A root header still affects every page.Navigation marks pages only when it changes
_nav.jsonedits used to re-render every page right away. They now mark pages only if navigation changed, and a formatting-only edit costs nothing.Stale pages render before they're served
The dev server used to answer with the old HTML, re-render in the background, then send a
page-renderedevent. That event usually arrived while the browser was still loading the old page, before its live-reload connection reopened, so it was lost and the stale page stayed. A page marked for re-rendering now renders before the response, so one reload shows the change. The background-render path and thepage-renderedevent are removed.Requests use the current builder
The request handler held the first builder forever. After any full rebuild, changes went to the new builder while requests asked the old one, so stale pages were never re-rendered on request. Requests now read the current builder.
Live reload for marked pages
IncrementalBuildResultgainsmarkedPages, and the dev server reloads the browser when pages were marked even though none rendered yet.Test temp folders
The ts-ssg tests that bundle scripts need the repository's
node_modules, so they create temp folders inside the repo. Those folders now go under.tmp/through a sharedmakeRepoTempDirhelper, instead of.tmp-*folders in the repo root.Unchanged, deliberately
siteConfig.jsonedits still trigger a full rebuild; config shapes every output.Docs
incremental.mdis rewritten to match the code, which it no longer described. The README's dev-mode list notes that affected pages re-render on their next request.Testing
guides/header.mdx, waits for the live-reload signal, then makes one request and asserts it shows the new header. It fails against the old serve-stale behavior._nav.jsonformatting-only versus reordering edits.