scroll to result if hash

This commit is contained in:
Guilhem
2026-02-06 16:34:54 +00:00
parent bfa128a3ac
commit f511ba8d26
@@ -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)