Skip to content

Commit 75fbfdc

Browse files
fix(frontend): #2049 Upgrade @tanstack/react-query from v4 to v5 (#2102)
1 parent 0731570 commit 75fbfdc

File tree

35 files changed

+6846
-10875
lines changed

35 files changed

+6846
-10875
lines changed

frontend/package-lock.json

Lines changed: 6740 additions & 10778 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@mui/icons-material": "^7.0.0",
1616
"@mui/material": "^7.0.0",
1717
"@mui/x-date-pickers": "^8.0.0",
18-
"@tanstack/react-query": "^4.36.1",
19-
"@tanstack/react-query-devtools": "^4.29.1",
18+
"@tanstack/react-query": "^5.83.0",
19+
"@tanstack/react-query-devtools": "^5.83.0",
2020
"@testing-library/dom": "^10.0.0",
2121
"@testing-library/react": "^16.0.0",
2222
"@testing-library/user-event": "^14.0.0",

frontend/src/components/BCHeader/UserButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const UserButton = () => {
2121
queryKey: ['role', 'forest-clients', selectedClientRoles!.clientId],
2222
queryFn: () => getForestClientByNumberOrAcronym(selectedClientRoles!.clientId),
2323
staleTime: THREE_HOURS,
24-
cacheTime: THREE_HALF_HOURS,
24+
gcTime: THREE_HALF_HOURS,
2525
enabled: !selectedClientRoles?.clientName,
2626
refetchOnReconnect: false
2727
});

frontend/src/components/ClientAndCodeInput/ClientSearchModal/ClientSearchFields.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const ClientSearchFields = ({
4848
onBlur={(e: React.ChangeEvent<HTMLInputElement>) => {
4949
setSearchWord(e.target.value);
5050
}}
51-
disabled={mutationFn.isLoading}
51+
disabled={mutationFn.isPending}
5252
/>
5353
</Column>
5454
<Column sm={1} md={3} lg={3} xlg={3}>
@@ -60,7 +60,7 @@ const ClientSearchFields = ({
6060
items={clientSearchOptions}
6161
initialSelectedItem={clientSearchOptions[0]}
6262
selectedItem={searchOption}
63-
disabled={mutationFn.isLoading}
63+
disabled={mutationFn.isPending}
6464
onChange={(e: ComboBoxEvent) => {
6565
setSearchOption(e.selectedItem);
6666
}}
@@ -75,7 +75,7 @@ const ClientSearchFields = ({
7575
: null
7676
}
7777
className="client-search-button"
78-
disabled={mutationFn.isLoading}
78+
disabled={mutationFn.isPending}
7979
onClick={
8080
searchWord.length
8181
? () => mutationFn.mutate()

frontend/src/components/ClientAndCodeInput/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ const ClientAndCodeInput = ({
7373
queryFn: () => getForestClientByNumberOrAcronym(clientInput.value),
7474
enabled: !!clientInput.value,
7575
staleTime: THREE_HOURS,
76-
cacheTime: THREE_HALF_HOURS
76+
gcTime: THREE_HALF_HOURS
7777
});
7878

7979
const defaultClientQuery = useQuery({
8080
queryKey: ['forest-clients', defaultClientNumber],
8181
queryFn: () => getForestClientByNumberOrAcronym(defaultClientNumber!),
8282
enabled: !!defaultClientNumber,
8383
staleTime: THREE_HOURS,
84-
cacheTime: THREE_HALF_HOURS
84+
gcTime: THREE_HALF_HOURS
8585
});
8686

8787
const updateAfterAgencyValidation = (updatedAgency: StringInputType) => {
@@ -367,11 +367,11 @@ const ClientAndCodeInput = ({
367367
? null
368368
: supportTexts.agency.helperText
369369
}
370-
invalid={clientInput.isInvalid && !validateClientAcronymMutation.isLoading}
370+
invalid={clientInput.isInvalid && !validateClientAcronymMutation.isPending}
371371
invalidText={invalidAcronymMessage}
372372
readOnly={
373373
(showCheckbox && isDefault)
374-
|| validateClientAcronymMutation.isLoading
374+
|| validateClientAcronymMutation.isPending
375375
|| readOnly
376376
}
377377
enableCounter
@@ -386,7 +386,7 @@ const ClientAndCodeInput = ({
386386
/>
387387
{
388388
renderLoading(
389-
validateClientAcronymMutation.isLoading,
389+
validateClientAcronymMutation.isPending,
390390
validateClientAcronymMutation.isSuccess,
391391
showClientValidationStatus,
392392
clientInput.id,
@@ -415,13 +415,13 @@ const ClientAndCodeInput = ({
415415
? null
416416
: supportTexts.locationCode.helperTextEnabled
417417
}
418-
invalid={locationCodeInput.isInvalid && !validateLocationCodeMutation.isLoading}
418+
invalid={locationCodeInput.isInvalid && !validateLocationCodeMutation.isPending}
419419
invalidText={((showCheckbox && isDefault) && locationCodeInput.value === '')
420420
? supportTexts.locationCode.invalidTextInterimSpecific
421421
: invalidLocationMessage}
422422
readOnly={
423423
(showCheckbox && isDefault)
424-
|| readOnly || clientInput.isInvalid || validateLocationCodeMutation.isLoading
424+
|| readOnly || clientInput.isInvalid || validateLocationCodeMutation.isPending
425425
}
426426
disabled={(isDefault && locationCodeInput.value === '')}
427427
onWheel={(e: React.ChangeEvent<HTMLInputElement>) => e.target.blur()}
@@ -433,7 +433,7 @@ const ClientAndCodeInput = ({
433433
/>
434434
{
435435
renderLoading(
436-
validateLocationCodeMutation.isLoading,
436+
validateLocationCodeMutation.isPending,
437437
validateLocationCodeMutation.isSuccess,
438438
showLocCodeValidationStatus,
439439
locationCodeInput.id,

frontend/src/components/ClientSearchTable/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const ClientSearchTable = (
8383
setProcessedData(sliced);
8484
};
8585

86-
if (mutationFn?.status === 'loading') {
86+
if (mutationFn?.status === 'pending') {
8787
return (
8888
<DataTableSkeleton
8989
showToolbar={false}

frontend/src/components/FavouriteActivities/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const FavouriteActivities = ({ isConsep }: FavouriteActivitiesProps) => {
6161
<Column sm={4} md={8} lg={16} xlg={12} className="favourite-activities-cards">
6262
<Row>
6363
{
64-
favActQuery.isLoading ? (
64+
favActQuery.isPending ? (
6565
<Loading role="status" aria-live="polite" withOverlay={false}>
6666
<span className="visually-hidden">Loading, please wait...</span>
6767
</Loading>

frontend/src/components/LotApplicantAndInfoForm/SeedlotInformation.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const SeedlotInformation = (
4242
queryFn: getVegCodes,
4343
enabled: !isEdit,
4444
staleTime: THREE_HOURS, // will not refetch for 3 hours
45-
cacheTime: THREE_HALF_HOURS, // data is cached 3.5 hours then deleted
45+
gcTime: THREE_HALF_HOURS, // data is cached 3.5 hours then deleted
4646
select: (data) => {
4747
let vegCodeOptions: Array<MultiOptionsObj> = [];
4848
if (data) {
@@ -59,7 +59,7 @@ const SeedlotInformation = (
5959
queryKey: ['seedlot-sources'],
6060
queryFn: () => getSeedlotSources(),
6161
staleTime: THREE_HOURS,
62-
cacheTime: THREE_HALF_HOURS
62+
gcTime: THREE_HALF_HOURS
6363
});
6464

6565
const setDefaultSource = (sources: SeedlotSourceType[]) => {
@@ -204,7 +204,7 @@ const SeedlotInformation = (
204204
onChange={(e: string) => handleSource(e)}
205205
>
206206
{
207-
seedlotSourcesQuery.status === 'loading'
207+
seedlotSourcesQuery.status === 'pending'
208208
? <RadioButtonSkeleton />
209209
: renderSources()
210210
}

frontend/src/components/LotApplicantAndInfoForm/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const LotApplicantAndInfoForm = ({
4545
queryFn: () => getForestClientByNumberOrAcronym(selectedClientRoles?.clientId!),
4646
enabled: !isEdit && !isReview && !!selectedClientRoles?.clientId,
4747
staleTime: THREE_HOURS,
48-
cacheTime: THREE_HALF_HOURS
48+
gcTime: THREE_HALF_HOURS
4949
}
5050
);
5151

frontend/src/components/OrganizationSelection/definitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type ClientTypeConfig = {
88

99
export type OrganizationItemProps = {
1010
forestClient?: ForestClientType
11-
queryState?: QueryState<unknown, undefined>
11+
queryState?: QueryState<unknown, Error>
1212
selected?: boolean
1313
}
1414

0 commit comments

Comments
 (0)