react-router icon indicating copy to clipboard operation
react-router copied to clipboard

[Bug]: Memory leak when using `<Redirect />` in tests with jest + JSDOM

Open Lukas-Kullmann opened this issue 1 year ago • 1 comments

What version of React Router are you using?

6.22.3

Steps to Reproduce

I created a reproduction repo: https://github.com/Lukas-Kullmann/react-router-memory-leak The steps to reproduce are described in that repo's readme.

Basically: Use <Redirect /> (or useRedirect()) in any of your components in your tests with jest + jsdom.

I use node v20.11.1 and npm v10.4.0.

Expected Behavior

The test does not leak memory, no matter if you use <Redirect /> or not.

Actual Behavior

Some objects stay in memory after the test if you use a <Redirect />. Most notably: JSDOM's Window object(s).

Lukas-Kullmann avatar Mar 14 '24 07:03 Lukas-Kullmann

Seem to be seeing a similar issue where tests are failing due a memory leak.

Has anyone deduced what is the latest version without this issue?

mikelnorth avatar Apr 16 '24 16:04 mikelnorth