Operator's declaration sequence affects behavior when using synchronous adapters (e.g. LocalStorage)
Description
persist() runs synchronously (because localStorage is synchronous) and immediately pushes a done event that doesn't have any watches yet. I think this is also true for other events, such as finally.
Reproduce
Link: https://stackblitz.com/edit/react-ts-wdmuyv?devToolsHeight=33&file=App.tsx
How to use: write any value into input, reload the page and watch the console – there are missing dataLoaded event. Comment out the second debug, uncomment the first debug and see how it works.
Current solution
Move persist() operator after all related sample and other effector operators.
Suggestions
- Add a Warning/Caution in the documentation to pay the attention of library users to this fact – it's confusing and not easy to detect;
- Review related code to make it works according to Effector ecosystem ideology.