Merged in fix/scroll-to-top-issue (pull request #2892)

fix: Update route info inside store before checking if path or lang has changed

* fix: Update route info inside store before checking if path or lang has changed


Approved-by: Linus Flood
This commit is contained in:
Erik Tiekstra
2025-10-01 11:15:59 +00:00
committed by Linus Flood
parent 85a925f281
commit 57315baf97
2 changed files with 4 additions and 2 deletions

View File

@@ -29,12 +29,13 @@ export default function RouteChange() {
return
}
updateRouteInfo(pathName, currentLang, searchParams)
if (hasPathOrLangChanged()) {
// Scroll to top on page load whenever page is navigated to new URL (page)
window.scrollTo({ top: 0, left: 0, behavior: "instant" })
}
updateRouteInfo(pathName, currentLang, searchParams)
if (
hasPathOrLangChanged() ||
hasBookingFlowParamsChanged(isSameBookingWidgetParams)

View File

@@ -29,12 +29,13 @@ export default function RouteChange() {
return
}
updateRouteInfo(pathName, currentLang, searchParams)
if (hasPathOrLangChanged()) {
// Scroll to top on page load whenever page is navigated to new URL (page)
window.scrollTo({ top: 0, left: 0, behavior: "instant" })
}
updateRouteInfo(pathName, currentLang, searchParams)
if (
hasPathOrLangChanged() ||
hasBookingFlowParamsChanged(isSameBookingWidgetParams)