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

Sometimes Transition renders child instanly #5193

Closed
dokugo opened this issue Nov 5, 2023 · 7 comments
Closed

Sometimes Transition renders child instanly #5193

dokugo opened this issue Nov 5, 2023 · 7 comments
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@dokugo
Copy link

dokugo commented Nov 5, 2023

What package has an issue

@mantine/core

Describe the bug

Sometimes Transition renders child instanly without actually transitioning, this happens when Transition status is currently exited and then its mounted prop value changes from false to true.

Here is the code to reproduce the problem:
https://codesandbox.io/p/devbox/mantine-transition-test-next-4dfvdc

Here is the screen recording. I toggle isVisible boolean value by clicking the first button. isVisible is used as the value of mounted Transition prop. After a few toggles the hidden button appears instantly.

toggling.mp4

Simulation of fast toggling:

interval.mp4

I'm not sure why exactly this happens. I tried experimenting with flushSync inside the handleStateChange function here, but without success.
https://github.com/mantinedev/mantine/blob/master/src/mantine-core/src/components/Transition/use-transition.ts#L41

What version of @mantine/* packages do you have in package.json? (Note that all @mantine/* packages must have the same version in order to work correctly)

7.1.7

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/p/devbox/mantine-transition-test-next-4dfvdc

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

None

Possible fix

No response

@rtivital rtivital added the help wanted Contributions from community are welcome label Nov 5, 2023
@ghana7989
Copy link
Contributor

Sandbox link is not working

@dokugo
Copy link
Author

dokugo commented Jan 15, 2024

@ghana7989 thanks, I fixed the link.

@cyantree
Copy link
Contributor

I think that's the same issue as #3126.

@cyantree
Copy link
Contributor

Please have a look at this comment where I've provided an example using a patched version of the library.

Could you please check whether this resolves the issue for you?

@rtivital rtivital added Fixed patch Completed issues that will be published with next patch (1.0.X) and removed help wanted Contributions from community are welcome labels Feb 26, 2024
@rtivital
Copy link
Member

Fixed in 7.6.1

@fauxparse
Copy link

Fixed in 7.6.1

It's still happening in the stories on the Mantine website, FYI :)

@devnaumov
Copy link

@rtivital Still happening for the modals manager example on the Mantine website. Modal opens instantly after several attempts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

6 participants