-
-
Notifications
You must be signed in to change notification settings - Fork 260
Description
What is the current behavior:
Units used with useUnit from effector-react/scope in next.js project is most likely has batching in the wrong way, and maybe for this reason when navigating when scope changes, in a certain case, these units lose synchronization and are no longer available for use.
In my case I have a simple toggler factory, so it is broken when you navigate to the same page.
Please provide the steps to reproduce and if possible a minimal demo of the problem via https://share.effector.dev, https://codesandbox.io or similar
- Open demo link
- Click to hamburger button to see that drawer that use the
$isOpen, toggle, ...state from toggler instance works correctly - Click to
GO_TO_THIS_PAGE_AGAINlink, and try to open hamburger menu again - it's broken now
Any another cases of navigation don't produce this issue:
- Click to
Go to another pagelink and repeat step 2 to see that all still works. - From page from step 3 you can go back to home page in 2 ways - 1st - with router events, 2nd - directly with link - all works fine as expected
What is the expected behavior:
I expected that useUnit have the same behavior as useStore/useEvent.
Because, if we will use it as a replacement for useUnit, the issue is gone.
Demo with useStore/useEvent without described bug: LINK HERE
Which versions of effector packages, and which browser and OS are affected by this issue? Did this work in previous versions of effector?:
All latest versions