question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add basic guards to avoid firing observer unnecessarily

See original GitHub issue

For example, we don’t need to recalculate all queries when a QUERY_STOP action happens, and this can be easily detected by === the data field.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
stubailocommented, May 18, 2016

Currently, broadcastQueries is called every time there is a change in the Redux store.

This then iterates over all of the query listeners, and calls those (defined here).

That ends up calling readSelectionSetFromStore if certain conditions are met, like if there are no errors, and the query is not loading, etc.

That calls observer.next, even if the query result is the same as before, which could end up re-rendering react components, etc.

The end result is that every time there is a Redux store change (even one that didn’t affect apollo at all), we re-run readSelectionSetFromStore and re-fire the next on any observable subscribers currently active.

However, the actual query results change pretty rarely! For example, if state.apollo === previousState.apollo, then we shouldn’t run anything at all. If state.apollo.data === previousState.apollo.data, then we don’t need to update any query results that we have already sent, etc.

This task is about adding some simple equality checks in the process to avoid firing every single query observable on every store change.

0reactions
abhiaiyer91commented, May 25, 2016

Solved in #226

Read more comments on GitHub >

github_iconTop Results From Across the Web

ATP 3-09.30 Observed Fires - Army Publishing Directorate
ATP 3-09.30 applies to the Active Army, Army National Guard of the ... The firing platoon is the basic firing element of the...
Read more >
RANGER HANDBOOK
(i) Avoid unnecessary duplication. (j) Provide for safety of friendly forces and installations. (k) Provide for flexibility. (l) Furnish the type of fire...
Read more >
Tactics, Techniques, and Procedures for the Field Artillery ...
A firing chart is a graphic representation of a portion of the earth's surface used for determining distance (or range) and direction (azimuth...
Read more >
Guide to Oracle Data Guard Fast-Start Failover
This document will guide you through configuring Oracle Data Guard Fast-Start Failover (FSFO) using a physical standby database.
Read more >
NTC TRENDS and TTPs, 1& - GlobalSecurity.org
TREND 1: Use of maneuver observers within the task force to request fires. ... commander's decisive point and each essential fire support task...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found