Skip to content

[v7] Skip view transitions on revalidation and initial hydration - #15485

Merged
brophdawg11 merged 3 commits into
remix-run:v7from
jbalsas:fix/skip-view-transitions-on-revalidation-and-hydration-v7
Sep 15, 2026
Merged

brophdawg11 merged 3 commits into
remix-run:v7from
jbalsas:fix/skip-view-transitions-on-revalidation-and-hydration-v7

Conversation

@jbalsas

@jbalsas jbalsas commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Backport of #15484 to v7. Fixes #15483 for the 7.x line.

router.revalidate() and the initial hydration both reach the POP view-transition replay in completeNavigation: revalidate() reuses state.historyAction (which is POP after back/forward or a reload) and initialize() runs the hydration as startNavigation(NavigationType.Pop, …). Because location === state.location in both cases, the appliedViewTransitions.has(location.pathname) fallback matches whenever the current path was ever a transition source in the tab, and a full view transition runs for a data refresh or a first render.

The same function already excludes uninterrupted revalidations from history handling a few lines above; this applies the same exclusion to the view-transition branch, plus state.initialized for hydration. PUSH/REPLACE and real back/forward replays are unchanged.

if (
  pendingAction === NavigationType.Pop &&
  !isUninterruptedRevalidation &&
  state.initialized
) {

Tests

Same two cases as #15484, added to view-transition-test.ts; both fail on v7 and pass with the change. The full __tests__/router suite passes (886 tests).

Runnable reproduction against 7.18.3: https://github.com/jbalsas/react-router-pop-revalidation-view-transition (StackBlitz: https://stackblitz.com/github/jbalsas/react-router-pop-revalidation-view-transition).

jbalsas and others added 2 commits September 9, 2026 21:41
`router.revalidate()` reuses `state.historyAction` and `initialize()` runs
the hydration as a POP, so both reached the POP view-transition replay in
`completeNavigation` and animated whenever the current path had previously
been a transition source, even though the location did not change.

Apply the `isUninterruptedRevalidation` exclusion the history branch
already uses, and skip the branch until the router is initialized.

Fixes remix-run#15483

Assisted-By: devx/a331d4aa-8096-49b6-b8e1-0c4ffbcb1ff3
(cherry picked from commit d0f2e9f)
Backport the fix and additional coverage from PR remix-run#15484 (7f124eb and 68a60db) to v7. Cover Back/Forward during and after hydration, same-URL history entries, and revalidation during a pending POP.
@brophdawg11
brophdawg11 merged commit 3e4d295 into remix-run:v7 Sep 15, 2026
6 checks passed
@remix-run-bot remix-run-bot mentioned this pull request Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants