fix: poll for containers after route transition animation
Sidebar Right now polls every 100ms (up to 1s) for containers to appear, instead of a single 200ms retry that missed animations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0f80ac1415
commit
eac6416569
@ -415,12 +415,19 @@ export function useControllerNav(containerRef?: { value: HTMLElement | null }) {
|
|||||||
if (dest) {
|
if (dest) {
|
||||||
focusEl(dest)
|
focusEl(dest)
|
||||||
} else {
|
} else {
|
||||||
// Containers may not be rendered yet (async load after route change)
|
// Containers not rendered yet (route transition / animation in progress)
|
||||||
// Retry after a short delay
|
// Poll until they appear, up to 1s
|
||||||
setTimeout(() => {
|
let attempts = 0
|
||||||
|
const poll = setInterval(() => {
|
||||||
|
attempts++
|
||||||
const retryContainers = getContainers()
|
const retryContainers = getContainers()
|
||||||
if (retryContainers[0]) focusEl(retryContainers[0])
|
if (retryContainers[0]) {
|
||||||
}, 200)
|
clearInterval(poll)
|
||||||
|
focusEl(retryContainers[0])
|
||||||
|
} else if (attempts >= 10) {
|
||||||
|
clearInterval(poll)
|
||||||
|
}
|
||||||
|
}, 100)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user