Skip to content

fix: MCD-993: Use page.waitForFunction for hydration helpers#41

Merged
fago merged 1 commit into1.xfrom
feature/MCD-993
Apr 17, 2026
Merged

fix: MCD-993: Use page.waitForFunction for hydration helpers#41
fago merged 1 commit into1.xfrom
feature/MCD-993

Conversation

@petarbasic
Copy link
Copy Markdown
Contributor

Summary

  • Replace page.evaluate-based hydration waits with page.waitForFunction in waitForNuxtHydration and waitForNuxtToBeReady
  • waitForFunction survives execution-context destruction caused by Vue Router's history.replaceState() during SSR hydration
  • Fixes flaky frontend-gallery-hash-navigation spec on LDP 25.x CI (~43% failure rate)

Root cause

Vue Router calls history.replaceState() during SSR hydration to inject route state. Chrome fires Page.navigatedWithinDocument which destroys Playwright's evaluate execution context. page.evaluate with a long-lived Promise dies; page.waitForFunction re-evaluates across context transitions by design.

Confirmed via CDP instrumentation on CI (captured navigationType: "historyApi" event 10ms before the evaluate error).

Test plan

  • Verified fix on LDP CI: PR #2645 build passed with composer patch applying this change
  • Merge this PR, release new version
  • Update LDP to use new release, remove composer patch

🤖 Generated with Claude Code

Replace page.evaluate-based hydration waits with page.waitForFunction,
which survives within-document navigations (history.replaceState) that
Vue Router fires during SSR hydration.
@fago fago merged commit f912a35 into 1.x Apr 17, 2026
@fago fago deleted the feature/MCD-993 branch April 17, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants