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

Review another state management #68

Closed
sergeysova opened this issue Oct 21, 2019 · 4 comments
Closed

Review another state management #68

sergeysova opened this issue Oct 21, 2019 · 4 comments

Comments

@sergeysova
Copy link

Please, review https://github.com/zerobias/effector and https://github.com/artalar/reatom

@alidcast
Copy link

came upon this repo: https://github.com/dai-shi/will-this-react-global-state-work-in-concurrent-mode

@JeremyRH looks like zustand's event emitter implementations will cause problems in concurrent mode? also, curious, is there a reason you guys decided against using context API with proxies?

@drcmda
Copy link
Member

drcmda commented Oct 22, 2019

shallow copies have subtle but interesting properties, for instance knowing from the root up which nodes have changed till the very last atomic. i always felt like it's a very simple but powerful concept that transcends languages - and if someone wants proxies: immer.

as for tearing, i've read up on it and bumped into the following written by @markerikson

Part of the idea behind using createContext for v6 was that since React ensures a given render pass uses the same context value everywhere, there would be no chance of tearing. The v6 implementation does work, but it's not as efficient in some cases as we'd hoped. We're currently working on coming up with a different internal implementation that goes back to using direct subscriptions instead. This does potentially mean that tearing is a possibility again, but at this point we need to sit back and wait for the React team to finish putting Concurrent Mode together before we can spend time seeing what the issues really are.

i like the levelheaded approach. it's fine to go and look what the problem could be, but i think it's too early to panic.

@JeremyRH
Copy link
Contributor

JeremyRH commented Oct 24, 2019

@alidcastano Creating a deep copy of the state, storing it in a ref, and updating it in useEffect solves the tearing issue. The problem is creating a deep copy of the state can be expensive and would have to be done in every call to the state setter or in useEffect. The issue that has me more concerned is "check4: proper update after interrupt". I haven't figured out how to solve this without using a context provider.

@dai-shi
Copy link
Member

dai-shi commented Aug 15, 2020

Closing this as it's stale. Please file a new issue for further discussion.

@dai-shi dai-shi closed this as completed Aug 15, 2020
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

5 participants