From f511ba8d26ce90b1f0ae6092ff187a8a416b983b Mon Sep 17 00:00:00 2001 From: Guilhem Date: Fri, 6 Feb 2026 16:34:54 +0000 Subject: [PATCH] scroll to result if hash --- .../(root)/(logged)/run/[...run]/+page.svelte | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte b/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte index 0c9cb9956c..ae136e92ee 100644 --- a/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte @@ -396,12 +396,26 @@ $effect(() => { job && untrack(() => onJobLoaded()) }) + $effect(() => { + // Scroll to hash when job loads and hash is present + if (job && currentHash) { + setTimeout(() => scrollToSection(currentHash), 100) + } + }) $effect(() => { // Initialize hash on mount and listen for hash changes currentHash = window.location.hash.slice(1) if (currentHash) { - // Small delay to ensure DOM is rendered - setTimeout(() => scrollToSection(currentHash), 100) + // Wait for job data and DOM to be fully rendered + const scrollToHash = () => { + if (document.getElementById(currentHash)) { + scrollToSection(currentHash) + } else { + // Retry if element not found yet (job data might still be loading) + setTimeout(scrollToHash, 200) + } + } + setTimeout(scrollToHash, 100) } window.addEventListener('hashchange', handleHashChange)