fix mobile view issue

This commit is contained in:
2026-06-15 18:20:48 +05:30
parent 205924e057
commit 0560b86b87
25 changed files with 956 additions and 99 deletions

View File

@@ -118,11 +118,20 @@ export default function LoadingScreen() {
const originalPushState = window.history.pushState;
const originalReplaceState = window.history.replaceState;
const scheduleHistoryTransition = (targetPath: string) => {
const currentPath = getRoutePath(new URL(window.location.href));
if (targetPath === currentPath) return;
window.setTimeout(() => {
startTransition(targetPath, true);
}, 0);
};
window.history.pushState = function patchedPushState(...args) {
const urlArg = args[2];
if (typeof urlArg === "string" || urlArg instanceof URL) {
const url = new URL(urlArg, window.location.href);
if (url.origin === window.location.origin) startTransition(getRoutePath(url));
if (url.origin === window.location.origin) scheduleHistoryTransition(getRoutePath(url));
}
return originalPushState.apply(this, args);
};
@@ -131,7 +140,7 @@ export default function LoadingScreen() {
const urlArg = args[2];
if (typeof urlArg === "string" || urlArg instanceof URL) {
const url = new URL(urlArg, window.location.href);
if (url.origin === window.location.origin) startTransition(getRoutePath(url));
if (url.origin === window.location.origin) scheduleHistoryTransition(getRoutePath(url));
}
return originalReplaceState.apply(this, args);
};