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); } } }