Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

EVG-16587 Bump Apollo and graphql deps #1365

Merged
merged 12 commits into from
Jul 7, 2022
Merged

Conversation

khelif96
Copy link
Contributor

@khelif96 khelif96 commented Jul 6, 2022

EVG-16587

Description

Bumps Apollo/client and graphql to latest versions.
Deletes unused graphql-tag dep

@khelif96 khelif96 requested a review from a team July 6, 2022 18:56
@@ -189,7 +189,6 @@
"eslint-plugin-storybook": "0.5.6",
Copy link
Contributor

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?

Screen Shot 2022-07-06 at 3 56 58 PM

Comment on lines +49 to +50
const [
getVersion,
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

] = useLazyQuery<VersionQuery, VersionQueryVariables>(GET_VERSION, {
variables: { id },
pollInterval,
fetchPolicy: "cache-and-network",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed unnecessary fetchNextPolicy thats behavior was updated in apollographql/apollo-client#8465

@@ -310,7 +310,9 @@ const attachProjectToRepoMock = {
},
result: {
data: {
id: "evergreen",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These mocks were invalid and were fixed.

fetchPolicy: "network-only",
nextFetchPolicy: "cache-and-network",
skip: !hasQueryVariables,
fetchPolicy: "cache-and-network",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nextFetchPolicy had inconsistent behavior which was fixed in a subsequent update. nextFetchPolicy would revert to the original fetchPolicy after it is called. I updated the fetchPolicy as well as updated the loading state of the table. Imo it works better than before. and is more in line with the loading behavior on the LG table

<PatchTasksTable
sorts={sorts}
tasks={tasks}
loading={tasks.length === 0}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this offers the best compromise between loading behavior and user experience.

If we have no data about the tasks we show the loading page but if we had previously visited a page we query in the background while showing the user somewhat stale data. This makes pagination seemless.

@minnakt minnakt self-requested a review July 7, 2022 19:54
@SupaJoon
Copy link
Contributor

SupaJoon commented Jul 7, 2022

LGTM

);
setIsLoadingData(false);
},
});
usePolling(startPolling, stopPolling, refetch, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you move usePolling up as well? The hook is always called right after query definitions, and it would be good to be consistent

Comment on lines 120 to 121
console.log("Calling getVersion");
console.log({ getVersion });
Copy link
Contributor

Choose a reason for hiding this comment

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

remove console.log

onError: (err) => {
dispatchToast.error(`Error fetching patch tasks ${err}`);
},
});
usePolling(startPolling, stopPolling, refetch);
const { patchTasks } = data || {};
const { tasks } = patchTasks || {};

const { tasks } = patchTasks || { tasks: [] };
Copy link
Contributor

Choose a reason for hiding this comment

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

alternatively const { tasks =[] } = patchTasks || {}, which would be parallel to what we have in TaskDuration.tsx

}

export const PatchTasksTable: React.VFC<Props> = ({ tasks, sorts }) => {
export const PatchTasksTable: React.VFC<Props> = ({
tasks = [],
Copy link
Contributor

Choose a reason for hiding this comment

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

most likely not necessary?

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

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

might be worth also changing the one in TaskDuration.tsx to look like this

<PatchTasksTable
sorts={sorts}
tasks={tasks}
loading={tasks.length === 0 && loading}
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@khelif96 khelif96 merged commit d79ef76 into evergreen-ci:main Jul 7, 2022
@khelif96 khelif96 deleted the EVG-16587 branch July 7, 2022 23:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants