[dagit] Stop overfetching root query
It appears that we are overfetching RootRepositoriesQuery during standard navigation in Dagit. This might not be a problem, except that we currently use cache-and-network for this query. This appears to have two effects that we must have been overlooking:
- The useQuery in useWorkspaceState switches to loading during the network fetch
- Verified with networkStatus value
- The data resulting from the network fetch *never* seems to === the previous data, even if it is identical
- Verified with isEqual and JSON.stringify comparisons
I'm not sure if this is related to a recent change, another bug somewhere, or if I've just been making incorrect assumptions about what useQuery does when cache-and-network is used. Either way, we should probably audit all of our cache-and-network callsites to see if they're doing terrible things.
I have a hunch that this is related to the issue that Prezi is running into where the entire app resets out of nowhere. The loading state of the useWorkspaceState is especially dangerous, as we use that to indicate that the entire app is starting up. My hope is that by eliminating this "loading" state generally, we can solve their issue as well.
Test Plan: Load Dagit, navigate around. Verify with logging and React profiler that the WorkspaceProvider does not re-render at any point.
Reviewers: bengotow, prha
Reviewed By: bengotow
Differential Revision: https://dagster.phacility.com/D8454