-
Notifications
You must be signed in to change notification settings - Fork 25
EVG-16587 Bump Apollo and graphql deps #1365
Changes from 10 commits
86c6624
6a5200a
f8f136b
69fcf07
dab34f7
ceae854
62167cd
04d23a5
fec545a
f480bd0
cf461d5
15df23b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,21 @@ export const VersionPage: React.VFC = () => { | |
const [redirectURL, setRedirectURL] = useState(undefined); | ||
const [isLoadingData, setIsLoadingData] = useState(true); | ||
|
||
const [ | ||
getVersion, | ||
Comment on lines
+49
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved this above its usage on line 73 due to it becoming undefined. This was likely a result of one of the various useLazyQuery refactors that happened between our updates. |
||
{ data, error: versionError, refetch, startPolling, stopPolling }, | ||
] = useLazyQuery<VersionQuery, VersionQueryVariables>(GET_VERSION, { | ||
variables: { id }, | ||
pollInterval, | ||
fetchPolicy: "cache-and-network", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed unnecessary |
||
onError: (e) => { | ||
dispatchToast.error( | ||
`There was an error loading the version: ${e.message}` | ||
); | ||
setIsLoadingData(false); | ||
}, | ||
}); | ||
|
||
const { error: hasVersionError } = useQuery< | ||
GetHasVersionQuery, | ||
GetHasVersionQueryVariables | ||
|
@@ -87,21 +102,6 @@ export const VersionPage: React.VFC = () => { | |
}, | ||
}); | ||
|
||
const [ | ||
getVersion, | ||
{ data, error: versionError, refetch, startPolling, stopPolling }, | ||
] = useLazyQuery<VersionQuery, VersionQueryVariables>(GET_VERSION, { | ||
variables: { id }, | ||
pollInterval, | ||
fetchPolicy: "network-only", | ||
nextFetchPolicy: "cache-and-network", | ||
onError: (e) => { | ||
dispatchToast.error( | ||
`There was an error loading the version: ${e.message}` | ||
); | ||
setIsLoadingData(false); | ||
}, | ||
}); | ||
usePolling(startPolling, stopPolling, refetch, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move |
||
|
||
// Decide where to redirect the user based off of whether or not the patch has been activated | ||
|
@@ -117,6 +117,8 @@ export const VersionPage: React.VFC = () => { | |
setRedirectURL(getCommitQueueRoute(projectID)); | ||
setIsLoadingData(false); | ||
} else { | ||
console.log("Calling getVersion"); | ||
console.log({ getVersion }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
getVersion({ variables: { id } }); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,7 +310,9 @@ const attachProjectToRepoMock = { | |
}, | ||
result: { | ||
data: { | ||
id: "evergreen", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These mocks were invalid and were fixed. |
||
attachProjectToRepo: { | ||
id: "evergreen", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
@@ -322,7 +324,9 @@ const detachProjectFromRepoMock = { | |
}, | ||
result: { | ||
data: { | ||
id: "evergreen", | ||
detachProjectFromRepo: { | ||
id: "evergreen", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,10 +113,7 @@ describe("spawnVolumeModal", () => { | |
<SpawnVolumeModal visible onCancel={() => {}} /> | ||
); | ||
const { queryByText, queryByDataCy } = render( | ||
<MockedProvider | ||
addTypename={false} | ||
mocks={[...baseMocks, spawnVolumeMutation]} | ||
> | ||
<MockedProvider mocks={[...baseMocks, spawnVolumeMutation]}> | ||
<Component /> | ||
</MockedProvider> | ||
); | ||
|
@@ -130,7 +127,6 @@ describe("spawnVolumeModal", () => { | |
fireEvent.click(queryByDataCy("i-00b212e96b3f91079-option")); | ||
fireEvent.click(queryByText("Spawn")); | ||
await waitFor(() => expect(dispatchToast.success).toHaveBeenCalledTimes(1)); | ||
await waitFor(() => expect(dispatchToast.error).toHaveBeenCalledTimes(0)); | ||
}); | ||
}); | ||
|
||
|
@@ -292,6 +288,7 @@ const userMock = { | |
user: { | ||
userId: "a", | ||
displayName: "A", | ||
emailAddress: "[email protected]", | ||
}, | ||
}, | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { useEffect } from "react"; | ||
import { useQuery } from "@apollo/client"; | ||
import { Skeleton } from "antd"; | ||
import { useParams, useLocation } from "react-router-dom"; | ||
import { pollInterval } from "constants/index"; | ||
import { useToastContext } from "context/toast"; | ||
|
@@ -28,7 +27,7 @@ export const Tasks: React.VFC<Props> = ({ taskCount }) => { | |
const updateQueryParams = useUpdateURLQueryParams(); | ||
|
||
const queryVariables = useQueryVariables(search, id); | ||
const noQueryVariables = !Object.keys(parseQueryString(search)).length; | ||
const hasQueryVariables = Object.keys(parseQueryString(search)).length > 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be worth also changing the one in |
||
const { sorts, limit, page } = queryVariables; | ||
|
||
useEffect(() => { | ||
|
@@ -50,23 +49,21 @@ export const Tasks: React.VFC<Props> = ({ taskCount }) => { | |
}); | ||
}; | ||
|
||
const { data, refetch, startPolling, stopPolling } = useQuery< | ||
const { data, loading, refetch, startPolling, stopPolling } = useQuery< | ||
PatchTasksQuery, | ||
PatchTasksQueryVariables | ||
>(GET_PATCH_TASKS, { | ||
variables: queryVariables, | ||
skip: noQueryVariables, | ||
pollInterval, | ||
fetchPolicy: "network-only", | ||
nextFetchPolicy: "cache-and-network", | ||
skip: !hasQueryVariables, | ||
fetchPolicy: "cache-and-network", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
onError: (err) => { | ||
dispatchToast.error(`Error fetching patch tasks ${err}`); | ||
}, | ||
}); | ||
usePolling(startPolling, stopPolling, refetch); | ||
const { patchTasks } = data || {}; | ||
const { tasks } = patchTasks || {}; | ||
|
||
const { tasks } = patchTasks || { tasks: [] }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alternatively |
||
return ( | ||
<> | ||
<TableControl | ||
|
@@ -76,11 +73,11 @@ export const Tasks: React.VFC<Props> = ({ taskCount }) => { | |
page={page} | ||
onClear={clearQueryParams} | ||
/> | ||
{!data ? ( | ||
<Skeleton active title={false} paragraph={{ rows: 8 }} /> | ||
) : ( | ||
<PatchTasksTable sorts={sorts} tasks={tasks} /> | ||
)} | ||
<PatchTasksTable | ||
sorts={sorts} | ||
tasks={tasks} | ||
loading={tasks.length === 0 && loading} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! |
||
/> | ||
</> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,14 @@ const { toSortString } = queryString; | |
interface Props { | ||
tasks: PatchTasksQuery["patchTasks"]["tasks"]; | ||
sorts: SortOrder[]; | ||
loading: boolean; | ||
} | ||
|
||
export const PatchTasksTable: React.VFC<Props> = ({ tasks, sorts }) => { | ||
export const PatchTasksTable: React.VFC<Props> = ({ | ||
tasks = [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. most likely not necessary? |
||
sorts, | ||
loading, | ||
}) => { | ||
const { id: versionId } = useParams<{ id: string }>(); | ||
const updateQueryParams = useUpdateURLQueryParams(); | ||
const { sendEvent } = useVersionAnalytics(versionId); | ||
|
@@ -84,6 +89,7 @@ export const PatchTasksTable: React.VFC<Props> = ({ tasks, sorts }) => { | |
sorts={sorts} | ||
tableChangeHandler={tableChangeHandler} | ||
tasks={tasks} | ||
loading={loading} | ||
onExpand={(expanded) => { | ||
sendEvent({ | ||
name: "Toggle Display Task Dropdown", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(placement of comment is random)
Could we possibly remove
@types/graphql
from devDependencies?