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

[@mantine/hooks] Support ref cleanup function in React 19 with useMergedRef #7304

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

elecdeer
Copy link
Contributor

fixes #7269

useMergedRef now properly handles ref callbacks that return cleanup functions in React 19.
For backward compatibility with React 18, it maintains the previous behavior of calling refs with null during unmount.

I have verified the functionality through a separate test repository, as direct testing within Mantine is not possible due to its React 18 dependency.
https://github.com/elecdeer/react-19-use-merge-ref/blob/main/react19/src/use-merged.ref.test.tsx

@rtivital
Copy link
Member

Please fix errors in tests

@elecdeer
Copy link
Contributor Author

done!

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.

useMergedRef does not supports React 19's cleanup functions for refs
2 participants