Skip to content

Conversation

@ridvansumset
Copy link
Contributor

This PR fixes a race condition where the internal collapse element ref can become null between scheduling a requestAnimationFrame and its execution, or between starting a transition and receiving the transitionend event.
When this happens, the current implementation tries to access scrollHeight on a null element and throws:

TypeError: Cannot read properties of null (reading 'scrollHeight')

The fix adds null checks for collapseRef in the requestAnimationFrame callbacks and in the transitionend handler. If the element has been unmounted, the callbacks now bail out early, preserving the existing behavior without throwing.

Screenshots from Sentry:
image
image

Lines caused error in our app:
image

@smastrom smastrom merged commit 369fa19 into smastrom:main Dec 14, 2025
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.

2 participants