Skip to content

Commit 06655d5

Browse files
committed
Fix: move the check before location.href change.
1 parent d10ebfa commit 06655d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Components/Web.JS/src/Services/NavigationEnhancement.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export async function performEnhancedPageLoad(internalDestinationHref: string, i
205205
},
206206
}, fetchOptions));
207207
let isNonRedirectedPostToADifferentUrlMessage: string | null = null;
208+
let forSamePath = isForSamePath(internalDestinationHref, currentContentUrl);
208209
await getResponsePartsWithFraming(responsePromise, abortSignal,
209210
(response, initialContent) => {
210211
const isGetRequest = !fetchOptions?.method || fetchOptions.method === 'get';
@@ -327,7 +328,7 @@ export async function performEnhancedPageLoad(internalDestinationHref: string, i
327328
const targetElem = document.getElementById(hash);
328329
targetElem?.scrollIntoView();
329330
}
330-
else if (!isForSamePath(internalDestinationHref, location.href)) {
331+
else if (!forSamePath) {
331332
resetScrollAfterNextBatch();
332333
}
333334

0 commit comments

Comments
 (0)