CodeSession polling interval captures stale session status
Severity: Medium
File: frontend/src/pages/Code/CodeSession.tsx:59
The useEffect hook sets up a 3-second polling interval that checks session?.status. However, the closure captures the session value at the time the effect runs. When loadData() updates session, the interval continues using the old status until the effect re-runs.
useEffect(() => {
loadData()
const interval = setInterval(() => {
if (session?.status === 'running' || session?.status === 'pending') {
loadData()
}
}, 3000)
return () => clearInterval(interval)
}, [loadData, session?.status])
Why it matters
When a session transitions from "running" to "completed", the polling may continue for several cycles before the effect cleanup runs, causing unnecessary API calls and potential UI flicker.
CodeSession polling interval captures stale session status
Severity: Medium
File:
frontend/src/pages/Code/CodeSession.tsx:59The
useEffecthook sets up a 3-second polling interval that checkssession?.status. However, the closure captures thesessionvalue at the time the effect runs. WhenloadData()updatessession, the interval continues using the old status until the effect re-runs.Why it matters
When a session transitions from "running" to "completed", the polling may continue for several cycles before the effect cleanup runs, causing unnecessary API calls and potential UI flicker.