-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Dispatching multiple actions doesn't update the component #70
Comments
So far I've tracked down that @Changed event is captured inside the store, but it isn't actually captured inside Changing line 48 from |
Maybe we need to fix dispatch internals. I will think what I can do here during this and next weeks. |
@ai I've tried playing with dispatch internals myself but couldn't find a proper solution there. Probs not a good idea to dig up in storeon's code at 2 am :D |
What behavior did you have with this scenario?
Am I right that using
Can I as you to quickly check with function component and |
There's a really annoying bug (or my misunderstanding of storeon conception) which actually prevents from using storeon at all (but I'd really love to :D)
I've created a component with the following codeI've managed to minimize the issue and find the temp solution (which is a terrible one, imho).
So, I have this component
articles/get action looks like this (I reduced the code to the minimum which reproduces the issue)
I was expecting the component to have the prop
isLoading
being updated twice - first set totrue
and then tofalse
. What I get - is no reaction at all for the component (even that the@changed
event was fired properly in storeon)But! then I changed the code slightly to this
And it worked as expected.
In a real world app I faced this very issue in a more complicated scenario
Basically, when I call articles/get with an argument I first try to look for the article in store and if I don't find one - I make the API call. Quite a common case for a small SPA. And when I find such an article already in store I immediately dispatch an action to set the article. And it fails, if I don't wrap all the async method in setImmediate (or if I don't maniacally add
await
to every store.dispatch, which is bs).The text was updated successfully, but these errors were encountered: