Skip to content

Align current Drupal page with Nuxt page commits - #4

Closed
StirStudios wants to merge 1 commit into
2.xfrom
fix/current-page-commit-timing
Closed

StirStudios wants to merge 1 commit into
2.xfrom
fix/current-page-commit-timing

Conversation

@StirStudios

Copy link
Copy Markdown
Owner

Summary

  • keep the fetched destination page key pending during client navigation
  • promote it to the page exposed by getPage() only when Nuxt emits page:finish
  • clear pending state after failed navigation or app:error
  • preserve immediate server assignment, hydration, redirects, custom keys, and fetchPage() results

Root cause

Nuxt keeps the outgoing <NuxtPage> committed while the destination resolves in Suspense. Drupal CE currently changes drupal-ce-current-page-key as soon as the destination request completes, or when its route watcher sees destination payload data. Shared layout components can consequently receive destination Drupal data while Nuxt is still displaying the outgoing page.

The required invariant is: getPage() represents the Drupal page Nuxt has committed, not the most recently completed request.

Change

The browser now tracks pending and current page keys separately. A completed destination fetch remains pending until page:finish, when Nuxt has committed it. Failed navigation and application errors discard the pending key. Server rendering still assigns immediately, hydration can expose its existing committed payload immediately, and redirect responses never become current pages.

This does not alter requests, cache keys, payload contents, redirect targets, CMS output, explicit custom-key lookups, or the page returned directly by fetchPage().

Evidence

  • full module suite: 35 files, 159 tests passed
  • focused regression coverage verifies:
    • destination fetch completion does not replace the current page early
    • page:finish promotes the destination
    • app:error discards pending state
  • focused ESLint check passed
  • DancePlug A/B reproduction:
    • existing behavior changed the current Drupal key 649 ms before page:finish
    • proposed behavior changes it with page:finish

This is intentionally separate from the consumer theme's route-snapshot lock: that protects route-derived shared UI, while this change corrects the lifecycle contract of Drupal CE's getPage() state.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T02:48:51.981055Z 0f92f2b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@StirStudios

Copy link
Copy Markdown
Owner Author

Closing this fork-local duplicate. The same validated branch is now proposed to the official upstream repository in drunomics#538.

@StirStudios StirStudios closed this Sep 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f92f2bff6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/runtime/composables/useDrupalCe/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant