fix(ui): cleanup leaking setTimeout / WS listeners in effects#19
fix(ui): cleanup leaking setTimeout / WS listeners in effects#19latteine1217 wants to merge 1 commit into
Conversation
Three useEffect hooks attached subscriptions or timers without returning a cleanup, leaking the registration on every re-run and on unmount. - DialogContainer / SubgraphEditorModal: capture setTimeout id and clear it in cleanup. - useGraphExecution: restructure into a single empty-deps effect that subscribes to tabStore directly. Per-tab WS listeners are now attached when a tab is created and detached when it is removed, preserving the "background tab still receives execution events" design while making the cleanup contract explicit. Verified with vitest (109/109), tsc -b, pnpm build, and react-doctor (0 errors, score 76 -> 78). End-to-end smoke test in the browser confirms multi-tab execution, dialog focus, and SubgraphEditor fitView all still work. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Please help me to run the newest test and make sure it passes all tests. Also, next time, if you find any problem, you may first create the issue so I can understand what this branch fixed. Thanks a lot. |
|
Thanks for the feedback! Two responses: 1. Latest test results on
The Actions CI is also green ( I also re-ran 2. On the "open an issue first" workflow: Understood — sorry for skipping that. Next time I'll open an issue describing the problem (in this case: react-doctor flagged 3 effect-cleanup leaks — one For visibility on what this branch actually fixed, here's the short version:
🤖 Generated with Claude Code |
Summary
Fix the 3
react-doctor/effect-needs-cleanuperrors flagged by react-doctor —useEffecthooks that attach subscriptions or timers without returning a cleanup, leaking the registration on every re-run and on unmount.setTimeoutid andclearTimeoutit in cleanup.tabStoredirectly. Per-tab WS listeners are now attached when a tab is created and detached when it is removed, preserving the original "background tab still receives execution events" design while making the cleanup contract explicit (and lint-clean).React-doctor score: 76 → 78 / 100 (3 errors → 0).
Test plan
pnpm test— 109 / 109 passingpnpm exec tsc -b --noEmit— cleanpnpm build— succeedsnpx react-doctor@latest .— 0 errorsexecution_start/node_status/execution_errorall delivered to correct tab's log🤖 Generated with Claude Code