Episode 07 game · Chitragupta · Water

Drain the Kappa’s Pond

Kai’s app gets slower with every click. Use it and watch what piles up on window, give each leaky effect the right cleanup, then prove it with ten visits.

ChitraguptaEvery time a page opens, I write a line in my ledger. Every time it closes, someone should erase it. Click around Kai’s app and watch my ledger.
07Seal 07
kai.app/search
Chitragupta’s ledger still alive on window
'resize' listeners1
clock intervals0
open chat sockets0
Memory held18 MB

1 · Feel the leak

Use Kai’s app like a real visitor: switch between Search, Home and Profile at least eight times. Watch what stays behind on window after each page closes.

Visits 1Leftovers 0
Unmount isn’t cleanup

React removes the page’s DOM, not the listeners and timers your effect added.

Return a cleanup

Undo what the effect started: remove, clear, close or abort.

Same function

removeEventListener only removes the exact function you added.