Component don't rerender if prop changes in short period of time
beautyfree opened this issue · comments
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
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.
Try deleting Drawer.Content. I then get the same result. Pretty sure it's just a race condition with the re-rendering engine.