Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-router as library for SPA. Detached Elements are created when navigating #12734

Closed
cheng500 opened this issue Jan 14, 2025 · 2 comments
Closed
Labels

Comments

@cheng500
Copy link

I'm using React Router as a...

library

Reproduction

https://stackblitz.com/edit/react-router-v7-detached-elements

  • Open Memory Tab in Browser Developer Tools
  • Navigate to "About" page
  • Click on "Click me" button
  • Navigate back to "Home" page
  • Create a "Detached Element" profile
  • Button is detached
  • Trigger garbage collection by clicking the "Bin" icon
  • Button remains detached
  • Repeat for multiple detached buttons
Screenshot 2025-01-14 at 09 26 04

Info: React Developer Tools extension also causes similar behavior. Remove extension or test using incognito to disable extensions

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (2) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    react-router: 7.1.1 => 7.1.1

Used Package Manager

npm

Expected Behavior

Button (and other elements) should be removed when garbage collection is triggered

Actual Behavior

Button (and other elements) remains in memory

@cheng500 cheng500 added the bug label Jan 14, 2025
@pawelblaszczyk5
Copy link

Afaik it has something to do with Chrome itself - facebook/react#31929
TanStack/router#3056
#12629

@timdorr
Copy link
Member

timdorr commented Jan 14, 2025

Correct, this isn't a bug with the library itself.

@timdorr timdorr closed this as completed Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants