Skip to content
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

Builder is called even when state is not changed #193

Open
guyo13 opened this issue Sep 24, 2020 · 1 comment
Open

Builder is called even when state is not changed #193

guyo13 opened this issue Sep 24, 2020 · 1 comment

Comments

@guyo13
Copy link

guyo13 commented Sep 24, 2020

I am working on an app where I use StoreConnectors heavily, I started noticing that the builder callback is being called - sometimes more than once - even if I don't make any changes to the state.
This happens when I for example open/close a Drawer or change focus between TextFields.

All my StoreConnectors are set to distinct=true and view models correctly implement operator == and hashCode
and really if the vms don't change then onDidChange is not fired.

I just don't understand why all those StoreConnectors keep firing their builders on every small user interaction.

Would be appreciated if anyone can help me understand why is this happening

@brianegan
Copy link
Owner

Heya @guyo13 -- When you open or close a drawer, Flutter is pushing a new route to the Navigator. This also causes most Widgets to rebuild -- so that's nothing to worry about.

On the other hand, if you're seeing your StoreConnectors rebuilding whenever you change focus, that sounds like a bug either in your app or Flutter Redux. However, I have tests in place specifically to verify Connectors only rebuild when they should, not on any little interaction, and I haven't seen that behavior in my own apps.

Do you happen to have a small sample that reproduces the error?

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

No branches or pull requests

2 participants