Commit 3111aea6 authored by Jimmy Lai's avatar Jimmy Lai

fix: also clear nextUrl in navigate-reducer for same-URL navigation

parent 7514f747
...@@ -41,6 +41,13 @@ export function navigateReducer( ...@@ -41,6 +41,13 @@ export function navigateReducer(
// state machine. // state machine.
const currentUrl = new URL(state.canonicalUrl, location.origin) const currentUrl = new URL(state.canonicalUrl, location.origin)
const currentRenderedSearch = state.renderedSearch const currentRenderedSearch = state.renderedSearch
// Clear nextUrl for same-page navigations to avoid re-triggering
// interception rewrites. When the user navigates to the same URL they're
// already on, we should not send the Next-Url header that would cause the
// server to apply interception rewrites again.
const nextUrl = url.href === currentUrl.href ? null : state.nextUrl
return navigateUsingSegmentCache( return navigateUsingSegmentCache(
state, state,
url, url,
...@@ -48,7 +55,7 @@ export function navigateReducer( ...@@ -48,7 +55,7 @@ export function navigateReducer(
currentRenderedSearch, currentRenderedSearch,
state.cache, state.cache,
state.tree, state.tree,
state.nextUrl, nextUrl,
FreshnessPolicy.Default, FreshnessPolicy.Default,
scrollBehavior, scrollBehavior,
navigateType navigateType
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment