Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Shared(global) state for some use cases #45

Open
pronevich opened this issue May 10, 2017 · 5 comments
Open

Shared(global) state for some use cases #45

pronevich opened this issue May 10, 2017 · 5 comments

Comments

@pronevich
Copy link

As I understand, freactal provide only local state concept. Maybe it would be make sense to add possibility to share some state (example: between pages in next.js) without composition on app root for preventing reconciliation on whole components tree.

Here @divmain twits about it https://twitter.com/divmain/status/861077765830852608

@divmain
Copy link
Contributor

divmain commented May 27, 2017

This is a tricky thing, and I'm not sure of the best way to go about accomplishing what you're attempting here. I'm not super familiar with Next.js yet, either, so it may take a bit of research before I come to a satisfying answer. If any other folks have ideas, I'm open to hearing them!

@stefanmaric
Copy link

I'm going to reference some related discussions here:

mobxjs/mobx#300
mobxjs/mobx#605

@divmain
Copy link
Contributor

divmain commented Nov 28, 2017

@pronevich, I've been thinking about your question a bit more, and this stuck out to me:

reconciliation on whole components tree

Is this happening for you? Due to how state is injected into components, a piece of state that is 1) tracked at the top level and 2) changed, should not result in a full VDOM reconciliation. It will result in a state reconciliation, checking whether the change in state should result in any re-renders, but this should be much less expensive (and honestly, exactly what we want).

Am I understanding the issue correctly?

@pronevich
Copy link
Author

Yes, exactly as you explain it

@divmain
Copy link
Contributor

divmain commented Dec 1, 2017

Would you be able to provide a reduced repro? I'm definitely interested in seeing areas where the state reconciliation results in an unnecessary VDOM reconciliation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants