Skip to content

Commit

Permalink
[2/4] Use wrapped useQuery/useLazyQuery (#23861)
Browse files Browse the repository at this point in the history
## Summary & Motivation

Ran `yarn lint --fix` on top of
#23860 and this is the output.

## How I Tested These Changes

buildkite.

## Changelog [New | Bug | Docs]
NOCHANGELOG
  • Loading branch information
salazarm authored Aug 28, 2024
1 parent 8afe956 commit 1382a4e
Show file tree
Hide file tree
Showing 246 changed files with 265 additions and 297 deletions.
3 changes: 1 addition & 2 deletions js_modules/dagster-ui/packages/ui-core/src/app/AppCache.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {InMemoryCache} from '@apollo/client';

import {InMemoryCache} from '../apollo-client';
import possibleTypes from '../graphql/possibleTypes.generated.json';

export const createAppCache = () =>
Expand Down
16 changes: 8 additions & 8 deletions js_modules/dagster-ui/packages/ui-core/src/app/AppProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import {
ApolloClient,
ApolloLink,
ApolloProvider,
HttpLink,
InMemoryCache,
split,
} from '@apollo/client';
import {RetryLink} from '@apollo/client/link/retry';
import {WebSocketLink} from '@apollo/client/link/ws';
import {getMainDefinition} from '@apollo/client/utilities';
Expand All @@ -30,6 +22,14 @@ import {WebSocketProvider} from './WebSocketProvider';
import {AnalyticsContext, dummyAnalytics} from './analytics';
import {migrateLocalStorageKeys} from './migrateLocalStorageKeys';
import {TimeProvider} from './time/TimeContext';
import {
ApolloClient,
ApolloLink,
ApolloProvider,
HttpLink,
InMemoryCache,
split,
} from '../apollo-client';
import {AssetLiveDataProvider} from '../asset-data/AssetLiveDataProvider';
import {AssetRunLogObserver} from '../asset-graph/AssetRunLogObserver';
import {CodeLinkProtocolProvider} from '../code-links/CodeLinkProtocol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ApolloLink} from '@apollo/client';
import {ApolloLink} from '../apollo-client';

export const createOperationQueryStringApolloLink = (basePath: string) =>
new ApolloLink((operation, forward) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {gql, useQuery} from '@apollo/client';
import * as React from 'react';

import {
PermissionFragment,
PermissionsQuery,
PermissionsQueryVariables,
} from './types/Permissions.types';
import {gql, useQuery} from '../apollo-client';
import {useBlockTraceOnQueryResult} from '../performance/TraceContext';

// used in tests, to ensure against permission renames. Should make sure that the mapping in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {gql} from '@apollo/client';
import {gql} from '../apollo-client';

export const PYTHON_ERROR_FRAGMENT = gql`
fragment PythonErrorFragment on PythonError {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {gql} from '@apollo/client';
import {Button, Colors, FontFamily, Icon} from '@dagster-io/ui-components';
import {Fragment, useRef} from 'react';
import styled from 'styled-components';

import {showSharedToaster} from './DomUtils';
import {useCopyToClipboard} from './browser';
import {PythonErrorChainFragment, PythonErrorFragment} from './types/PythonErrorFragment.types';
import {gql} from '../apollo-client';
import {ErrorSource} from '../graphql/types';
import {useLaunchPadHooks} from '../launchpad/LaunchpadHooksContext';
import {MetadataEntries} from '../metadata/MetadataEntry';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {NetworkStatus, ObservableQuery, QueryResult} from '@apollo/client';
import {RefreshableCountdown, useCountdown} from '@dagster-io/ui-components';
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';

import {NetworkStatus, ObservableQuery, QueryResult} from '../apollo-client';
import {useDocumentVisibility} from '../hooks/useDocumentVisibility';
import {isSearchVisible, useSearchVisibility} from '../search/useSearchVisibility';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {gql} from '@apollo/client';
import {print} from 'graphql';
import memoize from 'lodash/memoize';
import {useCallback, useContext} from 'react';
import {v4 as uuidv4} from 'uuid';

import {AppContext} from './AppContext';
import {PYTHON_ERROR_FRAGMENT} from './PythonErrorFragment';
import {gql} from '../apollo-client';

export enum TelemetryAction {
LAUNCH_RUN = 'LAUNCH_RUN',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {ApolloLink} from '@apollo/client';

import {debugLog, formatElapsedTimeWithMsec} from './Util';
import {ApolloLink} from '../apollo-client';

const getCalls = (response: any) => {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {ApolloClient, gql, useApolloClient} from '@apollo/client';
import React from 'react';

import {
AssetGraphLiveQuery,
AssetGraphLiveQueryVariables,
} from './types/AssetBaseDataProvider.types';
import {ApolloClient, gql, useApolloClient} from '../apollo-client';
import {
LiveDataForNode,
buildLiveDataForNode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {ApolloClient, gql, useApolloClient} from '@apollo/client';
import React from 'react';

import {
AssetStaleStatusDataQuery,
AssetStaleStatusDataQueryVariables,
} from './types/AssetStaleStatusDataProvider.types';
import {ApolloClient, gql, useApolloClient} from '../apollo-client';
import {tokenForAssetKey, tokenToAssetKey} from '../asset-graph/Utils';
import {AssetKeyInput} from '../graphql/types';
import {liveDataFactory} from '../live-data-provider/Factory';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {gql, useQuery} from '@apollo/client';

import {
AssetGraphSidebarQuery,
AssetGraphSidebarQueryVariables,
} from './types/AssetGraphJobSidebar.types';
import {gql, useQuery} from '../apollo-client';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PipelineSelector} from '../graphql/types';
import {useBlockTraceOnQueryResult} from '../performance/TraceContext';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql} from '@apollo/client';
import {Box, Colors, FontFamily, Icon, Tooltip} from '@dagster-io/ui-components';
import isEqual from 'lodash/isEqual';
import * as React from 'react';
Expand All @@ -11,6 +10,7 @@ import {ContextMenuWrapper} from './ContextMenuWrapper';
import {LiveDataForNode} from './Utils';
import {ASSET_NODE_NAME_MAX_LENGTH} from './layout';
import {AssetNodeFragment} from './types/AssetNode.types';
import {gql} from '../apollo-client';
import {withMiddleTruncation} from '../app/Util';
import {useAssetLiveData} from '../asset-data/AssetLiveDataProvider';
import {PartitionCountTags} from '../assets/AssetNodePartitionCounts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {gql, useSubscription} from '@apollo/client';
import {memo, useCallback, useEffect, useRef, useState} from 'react';

import {
AssetLiveRunLogsSubscription,
AssetLiveRunLogsSubscriptionVariables,
} from './types/AssetRunLogObserver.types';
import {gql, useSubscription} from '../apollo-client';
import {AssetKey} from '../graphql/types';

const OBSERVED_RUNS_CHANGED = 'observed-runs-changed';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {gql, useQuery} from '@apollo/client';
import {Box, Colors, ConfigTypeSchema, Icon, Spinner} from '@dagster-io/ui-components';
import {Link} from 'react-router-dom';
import styled from 'styled-components';

import {GraphNode, displayNameForAssetKey, nodeDependsOnSelf, stepKeyForAsset} from './Utils';
import {SidebarAssetQuery, SidebarAssetQueryVariables} from './types/SidebarAssetInfo.types';
import {AssetNodeForGraphQueryFragment} from './types/useAssetGraphData.types';
import {gql, useQuery} from '../apollo-client';
import {COMMON_COLLATOR} from '../app/Util';
import {useAssetLiveData} from '../asset-data/AssetLiveDataProvider';
import {ASSET_NODE_CONFIG_FRAGMENT} from '../assets/AssetConfig';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql} from '@apollo/client';
import groupBy from 'lodash/groupBy';
import keyBy from 'lodash/keyBy';
import reject from 'lodash/reject';
Expand All @@ -11,6 +10,7 @@ import {
AssetGraphQueryVariables,
AssetNodeForGraphQueryFragment,
} from './types/useAssetGraphData.types';
import {gql} from '../apollo-client';
import {usePrefixedCacheKey} from '../app/AppProvider';
import {GraphQueryItem, filterByQuery} from '../app/GraphQueryImpl';
import {AssetKey} from '../assets/types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {gql, useApolloClient} from '@apollo/client';
import {useCallback} from 'react';

import {isHiddenAssetGroupJob} from './Utils';
import {
AssetForNavigationQuery,
AssetForNavigationQueryVariables,
} from './types/useFindAssetLocation.types';
import {gql, useApolloClient} from '../apollo-client';
import {AssetKey} from '../assets/types';
import {AssetKeyInput} from '../graphql/types';
import {buildRepoAddress} from '../workspace/buildRepoAddress';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {gql} from '@apollo/client';

import {gql} from '../apollo-client';
import {CONFIG_TYPE_SCHEMA_FRAGMENT} from '../typeexplorer/ConfigTypeSchema';

export const ASSET_NODE_CONFIG_FRAGMENT = gql`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {gql, useQuery} from '@apollo/client';
import {Alert, Box, ButtonLink, Colors} from '@dagster-io/ui-components';

import {AssetKey} from './types';
import {
AssetDefinitionCollisionQuery,
AssetDefinitionCollisionQueryVariables,
} from './types/AssetDefinedInMultipleReposNotice.types';
import {gql, useQuery} from '../apollo-client';
import {showCustomAlert} from '../app/CustomAlertProvider';
import {displayNameForAssetKey} from '../asset-graph/Utils';
import {buildRepoPathForHuman} from '../workspace/buildRepoAddress';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql, useQuery} from '@apollo/client';
import {Box, Heading, Page, PageHeader, Tabs, Tag} from '@dagster-io/ui-components';
import React, {useCallback, useMemo} from 'react';
import {useHistory, useParams} from 'react-router-dom';
Expand All @@ -12,6 +11,7 @@ import {
AssetGroupMetadataQuery,
AssetGroupMetadataQueryVariables,
} from './types/AssetGroupRoot.types';
import {gql, useQuery} from '../apollo-client';
import {useTrackPageView} from '../app/analytics';
import {AssetGraphExplorer} from '../asset-graph/AssetGraphExplorer';
import {AssetLocation} from '../asset-graph/useFindAssetLocation';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {gql} from '@apollo/client';
import {Box, ButtonLink, Tooltip} from '@dagster-io/ui-components';
import * as React from 'react';
import {Link} from 'react-router-dom';

import {assetDetailsPathForKey} from './assetDetailsPathForKey';
import {AssetLineageFragment} from './types/AssetLineageElements.types';
import {gql} from '../apollo-client';
import {Timestamp} from '../app/time/Timestamp';

const AssetLineageInfoElement = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql, useQuery} from '@apollo/client';
import {Box, Caption, Colors, Icon, MiddleTruncate} from '@dagster-io/ui-components';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
Expand All @@ -13,6 +12,7 @@ import {
AssetMaterializationUpstreamTableFragment,
MaterializationUpstreamDataVersionFragment,
} from './types/AssetMaterializationUpstreamData.types';
import {gql, useQuery} from '../apollo-client';
import {Timestamp} from '../app/time/Timestamp';
import {displayNameForAssetKey} from '../asset-graph/Utils';
import {AssetKeyInput} from '../graphql/types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {gql} from '@apollo/client';
import {Box, MetadataTable} from '@dagster-io/ui-components';

import {AssetNodeOpMetadataFragment} from './types/AssetMetadata.types';
import {gql} from '../apollo-client';
import {DAGSTER_TYPE_FRAGMENT} from '../dagstertype/DagsterType';
import {DagsterTypeFragment} from '../dagstertype/types/DagsterType.types';
import {HIDDEN_METADATA_ENTRY_LABELS, MetadataEntry} from '../metadata/MetadataEntry';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql} from '@apollo/client';
import {
Body,
Box,
Expand All @@ -25,6 +24,7 @@ import {OverdueTag, freshnessPolicyDescription} from './OverdueTag';
import {UnderlyingOpsOrGraph} from './UnderlyingOpsOrGraph';
import {Version} from './Version';
import {AssetNodeDefinitionFragment} from './types/AssetNodeDefinition.types';
import {gql} from '../apollo-client';
import {COMMON_COLLATOR} from '../app/Util';
import {ASSET_NODE_FRAGMENT} from '../asset-graph/AssetNode';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {gql} from '@apollo/client';
import {useMemo} from 'react';

import {AssetNodeInstigatorsFragment} from './types/AssetNodeInstigatorTag.types';
import {gql} from '../apollo-client';
import {ScheduleOrSensorTag} from '../nav/ScheduleOrSensorTag';
import {SCHEDULE_SWITCH_FRAGMENT} from '../schedules/ScheduleSwitch';
import {ScheduleSwitchFragment} from '../schedules/types/ScheduleSwitch.types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql, useQuery} from '@apollo/client';
import {
Alert,
Box,
Expand Down Expand Up @@ -33,6 +32,7 @@ import {
} from './types/AssetPartitionDetail.types';
import {AssetObservationFragment} from './types/useRecentAssetEvents.types';
import {ASSET_MATERIALIZATION_FRAGMENT, ASSET_OBSERVATION_FRAGMENT} from './useRecentAssetEvents';
import {gql, useQuery} from '../apollo-client';
import {Timestamp} from '../app/time/Timestamp';
import {AssetStaleDataFragment} from '../asset-data/types/AssetStaleStatusDataProvider.types';
import {isHiddenAssetGroupJob, stepKeyForAsset} from '../asset-graph/Utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {RefetchQueriesFunction} from '@apollo/client';
import {
Box,
Button,
Expand All @@ -19,6 +18,7 @@ import {AssetWipeDialog} from 'shared/assets/AssetWipeDialog.oss';
import {LaunchAssetExecutionButton} from './LaunchAssetExecutionButton';
import {AssetTableFragment} from './types/AssetTableFragment.types';
import {AssetViewType} from './useAssetView';
import {RefetchQueriesFunction} from '../apollo-client';
import {CloudOSSContext} from '../app/CloudOSSContext';
import {useUnscopedPermissions} from '../app/Permissions';
import {QueryRefreshCountdown, RefreshState} from '../app/QueryRefresh';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {gql} from '@apollo/client';
import {gql} from '../apollo-client';

export const ASSET_TABLE_DEFINITION_FRAGMENT = gql`
fragment AssetTableDefinitionFragment on AssetNode {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql, useQuery} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {BreadcrumbProps} from '@blueprintjs/core';
import {Alert, Box, ErrorBoundary, NonIdealState, Spinner, Tag} from '@dagster-io/ui-components';
Expand Down Expand Up @@ -33,6 +32,7 @@ import {useDeleteDynamicPartitionsDialog} from './useDeleteDynamicPartitionsDial
import {healthRefreshHintFromLiveData} from './usePartitionHealthData';
import {useReportEventsModal} from './useReportEventsModal';
import {useWipeModal} from './useWipeModal';
import {gql, useQuery} from '../apollo-client';
import {currentPageAtom} from '../app/analytics';
import {Timestamp} from '../app/time/Timestamp';
import {AssetLiveDataRefreshButton, useAssetLiveData} from '../asset-data/AssetLiveDataProvider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {RefetchQueriesFunction} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {ProgressBar} from '@blueprintjs/core';
import {
Expand All @@ -16,6 +15,7 @@ import {memo, useMemo} from 'react';
import {VirtualizedSimpleAssetKeyList} from './VirtualizedSimpleAssetKeyList';
import {asAssetPartitionRangeInput} from './asInput';
import {useWipeAssets} from './useWipeAssets';
import {RefetchQueriesFunction} from '../apollo-client';
import {AssetKeyInput} from '../graphql/types';
import {NavigationBlock} from '../runs/NavigationBlock';
import {numberFormatter} from '../ui/formatters';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql, useApolloClient} from '@apollo/client';
import {Box, ButtonGroup} from '@dagster-io/ui-components';
import * as React from 'react';
import {useCallback, useContext, useEffect, useLayoutEffect, useMemo, useState} from 'react';
Expand All @@ -20,6 +19,7 @@ import {
} from './types/AssetsCatalogTable.types';
import {AssetViewType, useAssetView} from './useAssetView';
import {useBasicAssetSearchInput} from './useBasicAssetSearchInput';
import {gql, useApolloClient} from '../apollo-client';
import {AppContext} from '../app/AppContext';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {BreadcrumbProps} from '@blueprintjs/core';
import {Box} from '@dagster-io/ui-components';
Expand All @@ -10,6 +9,7 @@ import {AssetView} from './AssetView';
import {AssetsCatalogTable} from './AssetsCatalogTable';
import {assetDetailsPathForKey} from './assetDetailsPathForKey';
import {AssetKey, AssetViewParams} from './types';
import {gql} from '../apollo-client';
import {useTrackPageView} from '../app/analytics';
import {displayNameForAssetKey} from '../asset-graph/Utils';
import {useDocumentTitle} from '../hooks/useDocumentTitle';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {useQuery} from '@apollo/client';
import {Body2, Box, NonIdealState, Subheading} from '@dagster-io/ui-components';
import React from 'react';

Expand All @@ -14,6 +13,7 @@ import {
GetEvaluationsSpecificPartitionQuery,
GetEvaluationsSpecificPartitionQueryVariables,
} from './types/GetEvaluationsQuery.types';
import {useQuery} from '../../apollo-client';
import {ErrorWrapper} from '../../app/PythonErrorInfo';
import {SensorType} from '../../graphql/types';
import {useQueryPersistedState} from '../../hooks/useQueryPersistedState';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {gql, useQuery} from '@apollo/client';
import {
BaseTag,
Box,
Expand Down Expand Up @@ -29,6 +28,7 @@ import {
AssetConditionEvaluationRecordFragment,
GetEvaluationsSpecificPartitionQuery,
} from './types/GetEvaluationsQuery.types';
import {gql, useQuery} from '../../apollo-client';
import {formatElapsedTimeWithMsec} from '../../app/Util';
import {Timestamp} from '../../app/time/Timestamp';
import {DimensionPartitionKeys} from '../../graphql/types';
Expand Down
Loading

1 comment on commit 1382a4e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-j7b7ap957-elementl.vercel.app

Built with commit 1382a4e.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.