Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(lemon-ui): unmount leaked trees in LemonTree virtualization tests (#68525)

Robbie910cad4e72fe
diff --git a/frontend/src/lib/lemon-ui/LemonTree/LemonTree.test.tsx b/frontend/src/lib/lemon-ui/LemonTree/LemonTree.test.tsx
index 880abc1e96a8..7cd630c17c27 100644
--- a/frontend/src/lib/lemon-ui/LemonTree/LemonTree.test.tsx
+++ b/frontend/src/lib/lemon-ui/LemonTree/LemonTree.test.tsx
@@ -41,12 +41,6 @@ describe('LemonTree virtualization', () => {
})
afterEach(() => {
- // RTL's auto-cleanup is inert in this repo (jest.setup.ts imports @testing-library/react
- // during the setupFiles phase, before afterEach exists, so its hook never registers).
- // Without unmounting, each test leaves ~50 heavy rows mounted; every later waitFor's
- // act() then re-flushes all accumulated trees, ballooning 500ms tests to 3s+ and past
- // the per-test timeout on contended CI runners. Unmount while the synchronous rAF spy
- // is still installed so unmount work can't schedule timers into the next test.
cleanup()
requestAnimationFrameSpy.mockRestore()
cancelAnimationFrameSpy.mockRestore()