HomeElementl

Fix apollo cache reset race condition

Description

Fix apollo cache reset race condition

Summary:
Previously, we were doing a refetch on the root repositories query when we clicked the reload button. However, this isn't needed since we're already doing an apollo.resetStore when reloading a location. This diff removes the unnecessary refetch.

There is also a race condition with the new network only query used in the repository locations page. We need to refetch the network only query, but also need to reset the store. Apollo doesn't like when both things happen at the same time and throws an error. To mitigate this, I added a small timeout on the network-only refetch, but would appreciate any suggestions on a better/more correct way to fix this.

Finally, I've also added a toast that appears when reloading and hitting an error. We would previously only show a toast on reload success.

Test Plan: Reload repository locations in Dagit

Reviewers: dish, alangenfeld, prha

Reviewed By: dish

Differential Revision: https://dagster.phacility.com/D5299

Details

Provenance
sashankAuthored on Nov 25 2020, 6:14 PM
Reviewer
dish
Differential Revision
D5299: Fix apollo cache reset race condition
Parents
R1:e70dfb6fa235: Update README.md
Branches
Unknown
Tags
Unknown