Repository navigation
Align current Drupal page with Nuxt page commits - #538
Open
StirStudios wants to merge 4 commits into
Open
StirStudios wants to merge 4 commits into
StirStudios wants to merge 4 commits into
Conversation
Nuxt 4 purges the outgoing page's data when its page component unmounts, one tick before page:finish commits the destination key. getPage() still pointed at the outgoing key and returned an empty page for that tick. Rendering never saw it, but watchers in a persistent layout did: an editor toolbar that derived its account menu key from the page cleared and refetched the menu on every navigation. getPage() now returns the fetched destination in that gap, never a redirect payload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem and resulting behavior
During client navigation, Nuxt can keep the outgoing page visible while the destination resolves in Suspense. Drupal CE currently switches
getPage()when the destination fetch completes, allowing shared UI to read destination Drupal data while the outgoing page is still displayed. A DancePlug reproduction observed that switch 649 ms beforepage:finish.This change holds the destination key pending and promotes it on Nuxt's
page:finish. SSR assignment and initial hydration remain immediate. The directly returnedfetchPage()result and explicitgetPage(customKey)lookups remain available without waiting for a page commit.Navigation safeguards
The request version is per Nuxt application, alongside the existing page-key state; no global cross-request state or request cancellation is added.
Validation
Scope and compatibility
This corrects navigation timing; it does not change CDN cache keys, SSR payload migration, fetch cache keys, CMS responses, redirect targets or network request policy. The CDN-key work addresses server/browser payload identity during hydration; this PR complements it by delaying the current-page switch during navigation. No TBT improvement is claimed.
Consumers wanting destination data before commit should use the ref returned by
fetchPage()or an explicit custom-key lookup. The defaultgetPage()now retains outgoing data until page completion. The fixture covers the module's standard NuxtPage/Suspense/KeepAlive flow; it is not a guarantee for every custom nested/named NuxtPage arrangement. The consumer theme's route-snapshot protection remains a separate concern.