Skip to content

fix: detach useScrolling listener from observed element - #2725

Open
ArianMoeini wants to merge 1 commit into
streamich:masterfrom
ArianMoeini:fix/use-scrolling-cleanup
Open

ArianMoeini wants to merge 1 commit into
streamich:masterfrom
ArianMoeini:fix/use-scrolling-cleanup

Conversation

@ArianMoeini

Copy link
Copy Markdown

Description

useScrolling adds its scroll listener to ref.current, but cleanup reads the ref again. If it points to another element or becomes null before unmount, the original listener stays attached. Capture the observed element and detach from that same element.

This addresses a different cleanup case from the pending timer fix in #2698.

Type of change

  • Bug fix

Checklist

  • Read the Contributing Guide
  • Perform a code self-review
  • Cover changes with tests (ref replaced and ref cleared)
  • Ensure the test suite passes (yarn test: 77 suites, 494 tests)
  • Make sure code lints (yarn lint: 0 errors, 96 existing warnings)
  • Make sure types are fine (yarn lint:types)

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant