-
Notifications
You must be signed in to change notification settings - Fork 228
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
[addons-react] ConnectToStore called multiple time #287
Comments
Do you have store connections higher up in your component hierarchy? All updates will cascade from the top down unless you define |
I see. The Application component does have a |
It looks like in your case it's a different Each of the |
Okay about |
Yeah, that's odd then. Can you |
Actually, my I start an action in the route config (simplified a bit here) :
The action (again, simplified) :
The store :
I took these trace right after I switch to another route (/cupyou in this case) :
TRACE 1
TRACE 2
TRACE 3 (not exactly the same a 1)
TRACE 4 (again a bit different)
Sorry for the bad readability... And thank you for your time ! :) |
So it looks like this is the flow:
So it seems like Perhaps we can provide an option to flag certain props as influential to state or a hook to return before calling |
(Comment edited) |
ConnectToStores encapsulates all the logic of binding with the stores, it is a central point for this logic. In this case, why not change the connectToStores to bind with the Dispatcher and change the Dispatcher logic to only trigger one change per action dispatched? Is it possible? |
In which case you would base the state on props ? I never used the @pablolmiranda |
In some cases you may fetch data from your store based on the props that were passed in to a component. For example, an ArticleComponent that takes in an identifier for which article to display. It could call It's probably more often that you wouldn't want this, so maybe we should optimize for that path first and provide a way to trigger changes based on props. This would potentially break compatibility though. |
Oh my... Sorry I'm tired, I should think more before writing anything.. I'm actually using that exact |
I think #324 could be relevant here as a way of batching these changes together. |
I am facing the same issue of connectToStores called multiple times for no reason. It seems to batch multiple events, when I need them to be dispatched instantaneously. For eg: a loading state. |
Following the doc : http://fluxible.io/addons/connectToStores.html
connectToStores is listening to the stores for updates. It should only listen to the array of store passed in arguments, no ?
Using the generator-fluxible code base, when I do something like this :
connectToStores is called 3 times :
The expected one :
And two others times afterwards :
Why RouteStore and ApplicationStore changes are firing this ConnectToStore ? Am I missing something here ?
Thanks ! :)
The text was updated successfully, but these errors were encountered: