-
Notifications
You must be signed in to change notification settings - Fork 215
Flutter redux state changes not updating immediately #103
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
Comments
Hey there -- are you synchronously dispatching all of these actions one after the next? If so, that's probably the issue: Flutter may or may not re-render after each statement. Why? Because Flutter will then schedule the repaint to happen on the next Frame draw. If all of these actions happen before the next frame draw (which is very likely if they're all synchronous), then you won't see Flutter redraw the intermediate states. In fact, you can do the exact same thing without Redux! Just use If you're not calling these things synchronously, please let me know and I'll see if I can figure out the problem! Example using only setState and seeing the same behavior: https://gist.github.com/42b7e2ef856ca8f82f84c62cba46b2d4 |
Thank you for your quick response. |
Yep -- that is adding some time in between each setState call. Therefore, Flutter is rendering the intermediate states. The same thing should work with Redux -- if you performed |
I used the same way but it worked in different way. But i understood a little about how the redux state works. |
Hi @brianegan , I'm having the same issue of not updating the my View Model immediately after my Store is updated from an action executed within a Stream. I can see my store model gets updated, however it does not reflect on UI immediately. I'm not sure what you meant by "
" i'm executing the following code to dispatch my action which updates the model: ` try { } catch (error) { Any idea? |
Hello @brianegan , After reading what you wrote more carefully I realized that dispatching my action when listening to a stream would not actually update the UI immediately, exactly as if I'm calling setState() multiple times as per your example. But what's the solution? I'm listening to a Stream where it should update the UI each time I receive data from the Stream. I get my store state updated correctly as expected when dispatching the action with data from Stream, however UI doesn't get updated. Thank you! |
Hi,
I am new to flutter and redux. This library/package is very useful .But I am facing a problem with state updating in flutter widget. Without including redux , I have learnt that
setState
will automatically updates the UI widget tree.But using redux library/ package not updating immeditely untill all the statements are executed.
The below is the example of my issue :
(){ store.dispatch(FirstAction()); store.dispatch(SecondAction()); store.dispatch(ThirdAction()); }
Here the first action should change the UI widget tree immediately ,then the second action should be done then after the third action.
My 1st and 3rd actions are circularprogress bar indicator, and the second action is fetching data (http request).without changing the UI to circular progress bar indicator it performing the second action.
I hope a quick solution for my problem .
Thank you
The text was updated successfully, but these errors were encountered: