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

Component don't rerender if prop changes in short period of time #4216

Open
beautyfree opened this issue Nov 22, 2023 · 3 comments
Open

Component don't rerender if prop changes in short period of time #4216

beautyfree opened this issue Nov 22, 2023 · 3 comments

Comments

@beautyfree
Copy link

beautyfree commented Nov 22, 2023

Describe the bug
I don't know the reason, but looks like component don't rerender if prop changes in short period of time.
Just look on sandbox with react and preact below

To Reproduce
codesandbox.io/p/sandbox/young-architecture-6t4dzs

Expected behavior
Drawer opens like with react https://codesandbox.io/p/devbox/drawer-with-scale-forked-9pd3cx?file=%2Fapp%2Fmy-drawer.tsx%3A14%2C1

@beautyfree beautyfree changed the title Component don't rerender if props changes in short period of time Component don't rerender if prop changes in short period of time Nov 22, 2023
@CAYdenberg
Copy link

State updates are batched, so you can't count on multiple updates in a very close succession rendering on the "intermediate" state, even if you update them on different ticks of the event loop.

This is true in both react and preact, although the IRL effect may vary.

@beautyfree
Copy link
Author

beautyfree commented Nov 22, 2023

I have added logs and got this:

preact react
image image

preact has extra opened changed: false

maybe Vaul library has logic that works differently with preact, idk and it would be great to find a solution

@CAYdenberg
Copy link

Try deleting Drawer.Content. I then get the same result. Pretty sure it's just a race condition with the re-rendering engine.

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

No branches or pull requests

2 participants