You've already forked agentic-coding-workflow
fix(web): localStorage safety, default fetch timeout, visibility-aware polling
This commit is contained in:
@@ -18,13 +18,35 @@ export function useUnreadPoller() {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
function start() {
|
||||
if (timer !== null) return
|
||||
refresh()
|
||||
timer = setInterval(refresh, POLL_INTERVAL_MS)
|
||||
}
|
||||
|
||||
function stop() {
|
||||
if (timer !== null) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
}
|
||||
|
||||
function onVisibilityChange() {
|
||||
if (document.hidden) {
|
||||
stop()
|
||||
} else {
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
start()
|
||||
document.addEventListener('visibilitychange', onVisibilityChange)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (timer) clearInterval(timer)
|
||||
document.removeEventListener('visibilitychange', onVisibilityChange)
|
||||
stop()
|
||||
})
|
||||
|
||||
return { refresh, error }
|
||||
|
||||
Reference in New Issue
Block a user