Frontend: setTimeout/setInterval leaks across multiple screens — setState on unmounted components #111
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Patched the unmount-unsafe timers in ship-prep sweep:
PasswordResetModal— mountedRef guard around the 1.2sonSaveddelay (#111).Containersscreen —restartFlashtimer now stored in a ref, cleared on unmount, and the API resolution checksmountedRef.currentbeforesetState.Editor—saveTimerRef+ newstatusTimerRefboth cleared on unmount;saveSequence()and the 2s "Saved" clear now mount-guard theirsetState.All
setIntervalpolls in screens-home/ingest/asset/admin already had matchingclearIntervalreturns from their effects (verified during sweep).Closing as the bleeding edges are fixed. If new "setState on unmounted component" warnings show up post-ship, re-open with stack.
zgaetano referenced this issue2026-05-26 18:22:49 -04:00
Fix Plan — #111 setTimeout/setInterval leaks across screens
Root cause: Multiple screens fire
setTimeout/setIntervaloutsideuseEffector without cleanup. On unmount →setStateon unmounted component = memory leak + console warnings.Affected locations:
screens-ingest.jsx:214-240—pollRow()recursive setTimeout fromsubmit(), not useEffectscreens-library.jsx:144— setTimeout after.then()with no cleanupscreens-library.jsx:497-505— hover preview setTimeout fires fetch + setState 350ms laterscreens-editor.jsx:245— post-save setTimeoutscreens-ingest.jsx:1342— interval deps[load, schedules]recreate on every tickFix pattern — useEffect + cleanup:
Files:
screens-ingest.jsx,screens-library.jsx,screens-editor.jsxEffort: ~1.5h
**Priority: P2 — memory leaks