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

Don't fire the observer if the result of a query hasn't changed #400

Closed
Poincare opened this issue Jul 13, 2016 · 7 comments
Closed

Don't fire the observer if the result of a query hasn't changed #400

Poincare opened this issue Jul 13, 2016 · 7 comments
Assignees

Comments

@Poincare
Copy link
Contributor

If we have a watchQuery observer and we receive a result from the server that is identical to the last result we handed to the observer, we should not call the observer at all. This will prevent solutions like using shouldComponentUpdate and will reduce useless re-renders on the page.

@nevir
Copy link
Contributor

nevir commented Jul 17, 2016

I'm unsure if I'm running into the same thing, or a variation on it:

I have a watchQuery (with noFetch: true) - the observer's next fires 2 or 3 times each time the store is changed, even if some other portion of the store (not owned by apollo) was modified

@Poincare
Copy link
Contributor Author

Poincare commented Jul 18, 2016

@nevir Hm. That should not happen if the part of the store associated with the store was left untouched. Could you file an issue that would allow us to reproduce the problem? (a unit test would also be great!)

@Slava Slava mentioned this issue Jul 18, 2016
4 tasks
@Poincare
Copy link
Contributor Author

Since #402 was merged, this issue can now be closed.

@stubailo
Copy link
Contributor

And deployed!

@stubailo
Copy link
Contributor

@nevir can you check if 0.4.2 fixes your issue with multiple firing?

@nevir
Copy link
Contributor

nevir commented Jul 19, 2016

@stubailo can confirm - all better as of 0.4.2

@stubailo
Copy link
Contributor

Sweet! It really helped in our app as well.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants