From a3d76d0130b32d576cbc769a3b9328e0766b686e Mon Sep 17 00:00:00 2001 From: orangesurf Date: Tue, 9 Jun 2026 11:52:45 +0200 Subject: [PATCH] Track and clear redirect timer in handleDemoRedirect to prevent stacked navigations --- frontend/src/app/shared/common.utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/shared/common.utils.ts b/frontend/src/app/shared/common.utils.ts index c9a04fb09..9b50d0acd 100644 --- a/frontend/src/app/shared/common.utils.ts +++ b/frontend/src/app/shared/common.utils.ts @@ -223,6 +223,7 @@ export function sleep$(ms: number): Promise { } export function handleDemoRedirect(route: ActivatedRoute, router: Router) { + let demoRedirectTimer: ReturnType; route.queryParams .subscribe(params => { if (params.next) { @@ -230,7 +231,10 @@ export function handleDemoRedirect(route: ActivatedRoute, router: Router) { const index = path.indexOf(params.next); if (index >= 0) { const nextPath = path[(index + 1) % path.length]; - setTimeout(() => { window.location.replace(`${params.next}?next=${nextPath}`); }, 300000); + clearTimeout(demoRedirectTimer); + demoRedirectTimer = setTimeout(() => { + window.location.replace(`${path[index]}?next=${nextPath}`); + }, 300000); } } }