Skip to content

chore: upgrade tanstack/react-query to 5.77.0 #18039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions site/.storybook/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { DecoratorHelpers } from "@storybook/addon-themes";
import isChromatic from "chromatic/isChromatic";
import { StrictMode } from "react";
import { HelmetProvider } from "react-helmet-async";
import { QueryClient, QueryClientProvider, parseQueryArgs } from "react-query";
import { QueryClient, QueryClientProvider } from "react-query";
import { withRouter } from "storybook-addon-remix-react-router";
import "theme/globalFonts";
import themes from "../src/theme";
Expand Down Expand Up @@ -114,20 +114,7 @@ function withQuery(Story, { parameters }) {

if (parameters.queries) {
for (const query of parameters.queries) {
if (query.isError) {
// Based on `setQueryData`, but modified to set the result as an error.
const cache = queryClient.getQueryCache();
const parsedOptions = parseQueryArgs(query.key);
const defaultedOptions = queryClient.defaultQueryOptions(parsedOptions);
// Adds an uninitialized response to the cache, which we can now mutate.
const cachedQuery = cache.build(queryClient, defaultedOptions);
// Setting `manual` prevents retries.
cachedQuery.setData(undefined, { manual: true });
// Set the `error` value and the appropriate status.
cachedQuery.setState({ error: query.data, status: "error" });
} else {
queryClient.setQueryData(query.key, query.data);
}
queryClient.setQueryData(query.key, query.data);
}
}

Expand Down
4 changes: 2 additions & 2 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@radix-ui/react-slot": "1.1.1",
"@radix-ui/react-switch": "1.1.1",
"@radix-ui/react-tooltip": "1.1.7",
"@tanstack/react-query-devtools": "4.35.3",
"@tanstack/react-query-devtools": "5.77.0",
"@xterm/addon-canvas": "0.7.0",
"@xterm/addon-fit": "0.10.0",
"@xterm/addon-unicode11": "0.8.0",
Expand Down Expand Up @@ -103,7 +103,7 @@
"react-dom": "18.3.1",
"react-helmet-async": "2.0.5",
"react-markdown": "9.0.3",
"react-query": "npm:@tanstack/react-query@4.35.3",
"react-query": "npm:@tanstack/react-query@5.77.0",
"react-router-dom": "6.26.2",
"react-syntax-highlighter": "15.6.1",
"react-virtualized-auto-sizer": "1.0.24",
Expand Down
98 changes: 23 additions & 75 deletions site/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion site/src/api/queries/chats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const createChat = (queryClient: QueryClient) => {
return {
mutationFn: API.createChat,
onSuccess: async () => {
await queryClient.invalidateQueries(["chats"]);
await queryClient.invalidateQueries({ queryKey: ["chats"] });
},
};
};
Expand Down
4 changes: 2 additions & 2 deletions site/src/api/queries/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const health = () => ({
export const refreshHealth = (queryClient: QueryClient) => {
return {
mutationFn: async () => {
await queryClient.cancelQueries(HEALTH_QUERY_KEY);
await queryClient.cancelQueries({ queryKey: HEALTH_QUERY_KEY });
const newHealthData = await API.getHealth(true);
queryClient.setQueryData(HEALTH_QUERY_KEY, newHealthData);
},
Expand All @@ -38,7 +38,7 @@ export const updateHealthSettings = (
return {
mutationFn: API.updateHealthSettings,
onSuccess: async (_, newSettings) => {
await queryClient.invalidateQueries(HEALTH_QUERY_KEY);
await queryClient.invalidateQueries({ queryKey: HEALTH_QUERY_KEY });
queryClient.setQueryData(HEALTH_QUERY_SETTINGS_KEY, newSettings);
},
};
Expand Down
8 changes: 6 additions & 2 deletions site/src/api/queries/externalAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export const exchangeExternalAuthDevice = (
queryKey: ["external-auth", providerId, "device", deviceCode],
onSuccess: async () => {
// Force a refresh of the Git auth status.
await queryClient.invalidateQueries(["external-auth", providerId]);
await queryClient.invalidateQueries({
queryKey: ["external-auth", providerId],
});
},
};
};
Expand All @@ -57,7 +59,9 @@ export const unlinkExternalAuths = (queryClient: QueryClient) => {
return {
mutationFn: API.unlinkExternalAuthProvider,
onSuccess: async () => {
await queryClient.invalidateQueries(["external-auth"]);
await queryClient.invalidateQueries({
queryKey: ["external-auth"],
});
},
};
};
22 changes: 13 additions & 9 deletions site/src/api/queries/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ export const createGroup = (queryClient: QueryClient, organization: string) => {
mutationFn: (request: CreateGroupRequest) =>
API.createGroup(organization, request),
onSuccess: async () => {
await queryClient.invalidateQueries(groupsQueryKey);
await queryClient.invalidateQueries(
getGroupsByOrganizationQueryKey(organization),
);
await queryClient.invalidateQueries({
queryKey: groupsQueryKey,
});
await queryClient.invalidateQueries({
queryKey: getGroupsByOrganizationQueryKey(organization),
});
},
};
};
Expand Down Expand Up @@ -169,11 +171,13 @@ const invalidateGroup = (
groupId: string,
) =>
Promise.all([
queryClient.invalidateQueries(groupsQueryKey),
queryClient.invalidateQueries(
getGroupsByOrganizationQueryKey(organization),
),
queryClient.invalidateQueries(getGroupQueryKey(organization, groupId)),
queryClient.invalidateQueries({ queryKey: groupsQueryKey }),
queryClient.invalidateQueries({
queryKey: getGroupsByOrganizationQueryKey(organization),
}),
queryClient.invalidateQueries({
queryKey: getGroupQueryKey(organization, groupId),
}),
]);

function sortGroupsByName<T extends Group>(
Expand Down
4 changes: 3 additions & 1 deletion site/src/api/queries/idpsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export const patchOrganizationSyncSettings = (queryClient: QueryClient) => {
mutationFn: (request: OrganizationSyncSettings) =>
API.patchOrganizationIdpSyncSettings(request),
onSuccess: async () =>
await queryClient.invalidateQueries(getOrganizationIdpSyncSettingsKey()),
await queryClient.invalidateQueries({
queryKey: getOrganizationIdpSyncSettingsKey(),
}),
};
};

Expand Down
Loading
Loading