Skip to content

fix: memory leak in Link - #12326

Open
SimonSiefke wants to merge 1 commit into
facebook:mainfrom
SimonSiefke:agent/fix-link-intersection-observer-leak
Open

fix: memory leak in Link#12326
SimonSiefke wants to merge 1 commit into
facebook:mainfrom
SimonSiefke:agent/fix-link-intersection-observer-leak

Conversation

@SimonSiefke

@SimonSiefke SimonSiefke commented Jul 29, 2026

Copy link
Copy Markdown

Details

Docusaurus Link created a new callback ref on every render. React detached the old ref with null, but that path did not disconnect its IntersectionObserver, so the document's observer controller retained the old callback closure.

Change

Keep the callback ref stable while its inputs are unchanged, and disconnect and clear the active observer whenever the ref target changes or unmounts.

Before

When navigating between Playwright's Installation and Writing tests pages 37 times, the observer callback, innerRef, and interaction callback each grow by 3,922 instances:

before

After

No more matching Link observer leak is detected.

Test Video

test-video.webm

Additional Info

  • PR is AI-generated
  • Model: Codex (GPT-5.6)
  • Worktime: 46 minutes, 38 seconds

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Jul 29, 2026
@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 038e216
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a6a68ffb505fe00085c64e2
😎 Deploy Preview https://deploy-preview-12326--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant