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
Widget not rebuilding #77
Comments
Yah, this can be a tricky one!
In this case, the Redux part is synchronous and will inform Widget's that the state has changed -- but Flutter rebuilds Widgets on it's own schedule, generally after the current synchronous calls have executed. In your example, you're synchronously Locking, Doing some work, then Unlocking. Even if Flutter were fully synchronous itself, this would at best make the button Flash locked, then almost immediately go back to unlocked since you're performing these tasks one after the other. When do you want to Unlock the button? As a result of a Failure? Or after the |
@brianegan thx for your fast answer ! I want to unlock both on failure and on success |
Makes sense -- in that case, you need to move the That way, your Async work will complete, then |
Alright, I will try that when I get home, same for |
Nope! It sounds like you want the following Flow:
Therefore, you want to dispatch Lock immediately (synchronously), and dispatch Unlock when the Work is complete (asynchronously). |
Oh I get it now ! If I don't come back on this thread it means that you solved my problem, thx ! |
@arthurgustin Sure thing! Good luck :) |
Hi, I'm in a situation where I want to globally disable user input on certain events. For this I have created 2 actions,
Lock()
andUnlock()
that I dispatch before and after another action, like this:And in a top-level widget I have this kind of code:
The stacks put my loading animation on top of the real app.
And I have the feeling my widgets are not rebuilding untill the end of the function
onSave()
In my understanding, each trigerred actions would go through reducers, then middlewares, then the app rebuilds, so with my function
onSave()
, this workflow would execute 3 times right ?But fact is this does not work, I obviously missed something, but what... ?
The text was updated successfully, but these errors were encountered: