fix: improve use-merged-ref hook cleanup implementation #8118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dependencies check up
I have verified that I use latest version of all @mantine/* packages
What version of @mantine/* packages do you have in package.json?
7.17.8 and also tested on 8.1.3
What package has an issue?
@mantine/hooks
What framework do you use?
Vite
In which browsers you can reproduce the issue?
Chrome, Safari, Firefox
Describe the bug
It seems that when merging mantine refs to ReactDND refs, on unmount, we get errors about this cleanup function implemented from a prior PR: https://github.com/mantinedev/mantine/pull/7304/files#diff-7aaef3b012f983195f83037e3474a958b02ad5da696aaf2348b36bb529ce3b41
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
This PR attempts to fix the issue by checking if the cleanup function returned is actually a function
Self-service