-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Transition resolves instantly sometimes #3126
Comments
I cannot reproduce it in Chrome, Safari and Firefox on macOS. |
This comment was marked as resolved.
This comment was marked as resolved.
Your issue is not related to this issue, see https://mantine.dev/theming/theme-object/#respectreducemotion |
You are right. It does look to be the reduced motion settings. I'm sorry for the confusion. |
I can reproduce it on Win 10 with Chrome. It might be related to the following timeout: My theory: If I reduce the timeout from const preStateTimeout = window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
typeof preHandler === 'function' && preHandler();
setStatus(shouldMount ? 'entering' : 'exiting');
});
}); On the other hand increasing the timeout from So besides choosing an arbitrary timeout another solution might be switching to However in my tests I needed to wait for two frames to get it working. const preStateTimeout = window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
typeof preHandler === 'function' && preHandler();
setStatus(shouldMount ? 'entering' : 'exiting');
});
}); I don't know why this is. Maybe because the first |
I've checked this issue with the After some more digging I think I found the real problem: A solution for this would be forcing the state update with flushSync(() => {
setStatus(shouldMount ? 'pre-entering' : 'pre-exiting');
}); More details on this feature: Another solution could be using effect hooks that make sure that |
Hey there @rtivital just wanted to provide another replicated example that I think shows the issue more clear than the original video. I've noticed it for some time so I have avoided using it for anything interactive but I regularly check back on the component from time to time to see if it's better 😀. chrome, mantine 6, react 18, standard usage of component. In the video I am clicking pretty fast but it can happen after a long wait also. I hope this helps adjust this awesome component. 2023-07-06.11-17-46.mp4 |
This occurs on Windows 11 with Firefox as well. Text shows up before rather than along with the transition. |
I've revisited this issue and tried the Sandbox which uses a patched package: And here are the changes: If this seems fine I'll prepare a PR for it. |
Yeah, sure, you are welcome to submit a PR |
@cyantree I've copied and tested your changes, they work well. I've integrated them, so there is no need for a PR. Thanks for the research! |
Thanks @rtivital. I wanted to wait for some feedback from the issuers but if you already checked it out that's great! Happy to help out. |
Fixed in 7.6.1 |
I am still able to reproduce this in 7.6.1, though less often than before. It seems more prevalent when the example provided above is moved into storybook instead of codesandbox, and even more prevalent in Firefox compared to chromium based browsers. Please note I'm only checking the |
What package has an issue
@mantine/core
Describe the bug
Transition
sometimes shows its content instantly. I encountered this error in my app and was able to reproduce it on Mantine's documentation page on Transitions:Screencast.from.2022-12-06.13-08-32.webm
In the video, the dropdown is shown instantly when opening it the 4th and the 7th time.
I cannot reproduce this bug every time. It seems to happen randomly.
I am running Fedora 37. I encounter this bug in Mozilla Firefox 107.0, Chromium 105.0.5195.125 and Chrome 110.0.5449.0. I did not try it in other browsers or versions.
What version of @mantine/hooks page do you have in package.json?
5.9.0
If possible, please include a link to a codesandbox with the reproduced problem
https://mantine.dev/core/transition/
Do you know how to fix the issue
No.
Are you willing to participate in fixing this issue and create a pull request with the fix
I don't believe I can, so no.
The text was updated successfully, but these errors were encountered: