Page MenuHomePhabricator

[dagit] Fix root repository overfetching
ClosedPublic

Authored by dish on Wed, Nov 18, 3:33 PM.

Details

Summary

We're currently overfetching RootRepositoriesQuery in certain circumstances because some hooks lead to re-querying. Since we're using workspace state as a context value, we don't have to do this. We can just query up front and expose the relevant values via hooks that read from context. I figure I probably made this worse in my recent changes, and it needed to be cleaned up.

Refactor a bit to create WorkspaceProvider, which encapsulates the main workspace state hook and provides it as context (same as before), and rewrite some of the existing hooks to read from that context value instead of the query itself.

Test Plan

Lint, jest, ts.

Load Dagit and navigate around, monitoring Apollo dev tools to ensure that overfetching is not occurring. Namely, on the Runs page, ensure that the query is only fired once. Reload the repository, verify that it works as expected.

Diff Detail

Repository
R1 dagster
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.