From 57315baf97963cf26a7f54a749ddf77073d9718a Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Wed, 1 Oct 2025 11:15:59 +0000 Subject: [PATCH] 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 --- apps/partner-sas/components/RouteChange.tsx | 3 ++- apps/scandic-web/components/RouteChange.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/partner-sas/components/RouteChange.tsx b/apps/partner-sas/components/RouteChange.tsx index 768bae3bd..41070e9a9 100644 --- a/apps/partner-sas/components/RouteChange.tsx +++ b/apps/partner-sas/components/RouteChange.tsx @@ -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) diff --git a/apps/scandic-web/components/RouteChange.tsx b/apps/scandic-web/components/RouteChange.tsx index 7bd2fc45d..24ef45690 100644 --- a/apps/scandic-web/components/RouteChange.tsx +++ b/apps/scandic-web/components/RouteChange.tsx @@ -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)