diff --git a/frontend/package-lock.json b/frontend/package-lock.json index c802f7539..07fc3ca28 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,8 +11,8 @@ "@headlessui/react": "^1.7.8", "@mui/base": "^5.0.0-beta.3", "@mui/icons-material": "^5.14.9", - "@tanstack/react-query": "^4.24.10", - "@tanstack/react-query-devtools": "^4.24.12", + "@tanstack/react-query": "^5.0.5", + "@tanstack/react-query-devtools": "^5.4.2", "@webviz/subsurface-viewer": "^0.3.1", "@webviz/well-completions-plot": "^0.0.1-alpha.1", "animate.css": "^4.1.1", @@ -3312,45 +3312,38 @@ "@sinonjs/commons": "^3.0.0" } }, - "node_modules/@tanstack/match-sorter-utils": { - "version": "8.8.4", - "resolved": "https://registry.npmjs.org/@tanstack/match-sorter-utils/-/match-sorter-utils-8.8.4.tgz", - "integrity": "sha512-rKH8LjZiszWEvmi01NR72QWZ8m4xmXre0OOwlRGnjU01Eqz/QnN+cqpty2PJ0efHblq09+KilvyR7lsbzmXVEw==", - "dependencies": { - "remove-accents": "0.4.2" - }, - "engines": { - "node": ">=12" - }, + "node_modules/@tanstack/query-core": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.0.5.tgz", + "integrity": "sha512-MThCETMkHDHTnFZHp71L+SqTtD5d6XHftFCVR1xRJdWM3qGrlQ2VCXaj0SKVcyJej2e1Opa2c7iknu1llxCDNQ==", "funding": { "type": "github", - "url": "https://github.com/sponsors/kentcdodds" + "url": "https://github.com/sponsors/tannerlinsley" } }, - "node_modules/@tanstack/query-core": { - "version": "4.32.0", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-4.32.0.tgz", - "integrity": "sha512-ei4IYwL2kmlKSlCw9WgvV7PpXi0MiswVwfQRxawhJA690zWO3dU49igaQ/UMTl+Jy9jj9dK5IKAYvbX7kUvviQ==", + "node_modules/@tanstack/query-devtools": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.4.2.tgz", + "integrity": "sha512-EXdaMXi8CxZuMp97J5mq6wy1RduOfoWFv5vtA1U+hyqb8Wst6M8kkkjDSdFvGZIRpYY4K8mKLlEFHNUZDG5dtw==", "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" } }, "node_modules/@tanstack/react-query": { - "version": "4.32.0", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-4.32.0.tgz", - "integrity": "sha512-B8WUMcByYAH9500ENejDCATOmEZhqjtS9wsfiQ3BNa+s+yAynY8SESI8WWHhSqUmjd0pmCSFRP6BOUGSda3QXA==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.0.5.tgz", + "integrity": "sha512-ZG0Q4HZ0iuI8mWiZ2/MdVYPHbrmAVhMn7+gLOkxJh6zLIgCL4luSZlohzN5Xt4MjxfxxWioO1nemwpudaTsmQg==", "dependencies": { - "@tanstack/query-core": "4.32.0", - "use-sync-external-store": "^1.2.0" + "@tanstack/query-core": "5.0.5" }, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^18.0.0", + "react-dom": "^18.0.0", "react-native": "*" }, "peerDependenciesMeta": { @@ -3363,22 +3356,20 @@ } }, "node_modules/@tanstack/react-query-devtools": { - "version": "4.32.0", - "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-4.32.0.tgz", - "integrity": "sha512-rOmWqzKzRmQrQULV5Ova2FGEEPT76FZA3hz8T+LFkvp3ehw9ugSZ1BosgRJ7AFCeir+5pcNvFwILy4pDK8HpRw==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.4.2.tgz", + "integrity": "sha512-bdJvnoKqHlh7sBTHC9O88WaqLu1D8wDrP0IstOhDODaPJfxW26yJOKK1/1uPQpZXFoOtFFYHpCqKoM58DBrWSQ==", "dependencies": { - "@tanstack/match-sorter-utils": "^8.7.0", - "superjson": "^1.10.0", - "use-sync-external-store": "^1.2.0" + "@tanstack/query-devtools": "5.4.2" }, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "@tanstack/react-query": "4.32.0", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + "@tanstack/react-query": "^5.0.5", + "react": "^18.0.0", + "react-dom": "^18.0.0" } }, "node_modules/@tanstack/react-virtual": { @@ -5743,20 +5734,6 @@ "lodash.keys": "2.3.x" } }, - "node_modules/copy-anything": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", - "integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==", - "dependencies": { - "is-what": "^4.1.8" - }, - "engines": { - "node": ">=12.13" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" - } - }, "node_modules/core-assert": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/core-assert/-/core-assert-0.2.1.tgz", @@ -9359,17 +9336,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-what": { - "version": "4.1.15", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.15.tgz", - "integrity": "sha512-uKua1wfy3Yt+YqsD6mTUEa2zSi3G1oPlqTflgaPJ7z63vUGN5pxFpnQfeSLMFnJDEsdvOtkp1rUWkYjB4YfhgA==", - "engines": { - "node": ">=12.13" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" - } - }, "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", @@ -13361,11 +13327,6 @@ "regl-scatter2d": "^3.2.3" } }, - "node_modules/remove-accents": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.4.2.tgz", - "integrity": "sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==" - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -14232,17 +14193,6 @@ "kdbush": "^3.0.0" } }, - "node_modules/superjson": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/superjson/-/superjson-1.13.1.tgz", - "integrity": "sha512-AVH2eknm9DEd3qvxM4Sq+LTCkSXE2ssfh1t11MHMXyYXFQyQ1HLgVvV+guLTsaQnJU3gnaVo34TohHPulY/wLg==", - "dependencies": { - "copy-anything": "^3.0.2" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/superscript-text": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/superscript-text/-/superscript-text-1.0.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index d609be2dc..fc12bfd4e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -18,8 +18,8 @@ "@headlessui/react": "^1.7.8", "@mui/base": "^5.0.0-beta.3", "@mui/icons-material": "^5.14.9", - "@tanstack/react-query": "^4.24.10", - "@tanstack/react-query-devtools": "^4.24.12", + "@tanstack/react-query": "^5.0.5", + "@tanstack/react-query-devtools": "^5.4.2", "@webviz/subsurface-viewer": "^0.3.1", "@webviz/well-completions-plot": "^0.0.1-alpha.1", "animate.css": "^4.1.1", diff --git a/frontend/src/framework/internal/EnsembleSetLoader.ts b/frontend/src/framework/internal/EnsembleSetLoader.ts index 81f2f3b00..9383037b7 100644 --- a/frontend/src/framework/internal/EnsembleSetLoader.ts +++ b/frontend/src/framework/internal/EnsembleSetLoader.ts @@ -4,7 +4,7 @@ import { QueryClient } from "@tanstack/react-query"; import { Ensemble } from "../Ensemble"; import { EnsembleIdent } from "../EnsembleIdent"; -import { Parameter, ParameterType, ContinuousParameter, DiscreteParameter } from "../EnsembleParameters"; +import { ContinuousParameter, DiscreteParameter, Parameter, ParameterType } from "../EnsembleParameters"; import { Sensitivity, SensitivityCase } from "../EnsembleSensitivities"; import { EnsembleSet } from "../EnsembleSet"; @@ -29,7 +29,7 @@ export async function loadEnsembleSetMetadataFromBackend( queryKey: ["getEnsembleDetails", caseUuid, ensembleName], queryFn: () => apiService.explore.getEnsembleDetails(caseUuid, ensembleName), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, }); ensembleDetailsPromiseArr.push(ensembleDetailsPromise); @@ -37,7 +37,7 @@ export async function loadEnsembleSetMetadataFromBackend( queryKey: ["getParameters", caseUuid, ensembleName], queryFn: () => apiService.parameters.getParameters(caseUuid, ensembleName), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, }); parametersPromiseArr.push(parametersPromise); @@ -45,7 +45,7 @@ export async function loadEnsembleSetMetadataFromBackend( queryKey: ["getSensitivities", caseUuid, ensembleName], queryFn: () => apiService.parameters.getSensitivities(caseUuid, ensembleName), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, }); sensitivitiesPromiseArr.push(sensitivitiesPromise); } @@ -141,8 +141,7 @@ function buildParameterArrFromApiResponse(apiParameterArr: EnsembleParameter_api values: apiPar.values as number[], }; retParameterArr.push(retPar); - } - else { + } else { const retPar: DiscreteParameter = { type: ParameterType.DISCRETE, name: apiPar.name, diff --git a/frontend/src/framework/internal/components/SelectEnsemblesDialog/private-components/userAvatar.tsx b/frontend/src/framework/internal/components/SelectEnsemblesDialog/private-components/userAvatar.tsx index 7870d6d62..d4356970b 100644 --- a/frontend/src/framework/internal/components/SelectEnsemblesDialog/private-components/userAvatar.tsx +++ b/frontend/src/framework/internal/components/SelectEnsemblesDialog/private-components/userAvatar.tsx @@ -18,7 +18,7 @@ function useUserInfoQuery(userId: string): UseQueryResult { queryKey: ["getUserInfo", userId], queryFn: () => apiService.graph.userInfo(`${userId.toUpperCase()}@equinor.com`), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: userId !== "", }); } diff --git a/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx b/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx index a9975fec7..07393047e 100644 --- a/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx +++ b/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx @@ -78,7 +78,7 @@ export const SelectEnsemblesDialog: React.FC = (prop return apiService.explore.getCases(selectedField); }, enabled: fieldsQuery.isSuccess, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, staleTime: STALE_TIME, }); @@ -97,7 +97,7 @@ export const SelectEnsemblesDialog: React.FC = (prop return apiService.explore.getEnsembles(selectedCaseId); }, enabled: casesQuery.isSuccess, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, staleTime: STALE_TIME, }); diff --git a/frontend/src/framework/internal/providers/QueryClientProvider.tsx b/frontend/src/framework/internal/providers/QueryClientProvider.tsx index 2155f76a3..0b6fc2c17 100644 --- a/frontend/src/framework/internal/providers/QueryClientProvider.tsx +++ b/frontend/src/framework/internal/providers/QueryClientProvider.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { QueryCache, QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { MutationCache, QueryCache, QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; import { AuthState, useAuthProvider } from "./AuthProvider"; @@ -25,12 +25,12 @@ export const CustomQueryClientProvider: React.FC<{ children: React.ReactElement refetchOnWindowFocus: false, refetchOnMount: false, refetchOnReconnect: true, - cacheTime: 0, + gcTime: 0, }, }, queryCache: new QueryCache({ - onError: async (error) => { - if (error && (error as QueryError).status === 401) { + onError: (error) => { + if (error && (error as unknown as QueryError).status === 401) { authProvider.setAuthState(AuthState.NotLoggedIn); } }, diff --git a/frontend/src/modules/Grid3D/queryHooks.ts b/frontend/src/modules/Grid3D/queryHooks.ts index 0fc0c29ca..ae75dd328 100644 --- a/frontend/src/modules/Grid3D/queryHooks.ts +++ b/frontend/src/modules/Grid3D/queryHooks.ts @@ -19,7 +19,7 @@ export function useGridSurface( apiService.grid.gridSurface(caseUuid ?? "", ensembleName ?? "", gridName ?? "", realization ?? ""), select: transformGridSurface, staleTime: STALE_TIME, - cacheTime: 0, + gcTime: 0, enabled: caseUuid && ensembleName && gridName && realization ? true : false, }); } @@ -43,7 +43,7 @@ export function useGridParameter( realization ?? "" ), staleTime: STALE_TIME, - cacheTime: 0, + gcTime: 0, enabled: caseUuid && ensembleName && gridName && parameterName && realization && !useStatistics ? true : false, }); } @@ -67,7 +67,7 @@ export function useStatisticalGridParameter( realizations ?? [] ), staleTime: STALE_TIME, - cacheTime: 0, + gcTime: 0, enabled: caseUuid && ensembleName && gridName && parameterName && realizations && useStatistics ? true : false, }); } @@ -77,7 +77,7 @@ export function useGridModelNames(caseUuid: string | null, ensembleName: string queryKey: ["getGridModelNames", caseUuid, ensembleName], queryFn: () => apiService.grid.getGridModelNames(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } @@ -91,7 +91,7 @@ export function useGridParameterNames( queryKey: ["getParameterNames", caseUuid, ensembleName, gridName], queryFn: () => apiService.grid.getParameterNames(caseUuid ?? "", ensembleName ?? "", gridName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName && gridName ? true : false, }); } @@ -101,7 +101,7 @@ export function useGetWellHeaders(caseUuid: string | undefined): UseQueryResult< queryKey: ["getWellHeaders", caseUuid], queryFn: () => apiService.well.getWellHeaders(caseUuid ?? ""), staleTime: STALE_TIME, - cacheTime: STALE_TIME, + gcTime: STALE_TIME, enabled: caseUuid ? true : false, }); } @@ -111,7 +111,7 @@ export function useGetFieldWellsTrajectories(caseUuid: string | undefined): UseQ queryKey: ["getFieldWellsTrajectories", caseUuid], queryFn: () => apiService.well.getFieldWellTrajectories(caseUuid ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid ? true : false, }); } diff --git a/frontend/src/modules/Grid3DIntersection/queryHooks.ts b/frontend/src/modules/Grid3DIntersection/queryHooks.ts index b5edabc66..28b19c30a 100644 --- a/frontend/src/modules/Grid3DIntersection/queryHooks.ts +++ b/frontend/src/modules/Grid3DIntersection/queryHooks.ts @@ -2,49 +2,83 @@ import { GridIntersection_api } from "@api"; import { apiService } from "@framework/ApiService"; import { UseQueryResult, useQuery } from "@tanstack/react-query"; - const STALE_TIME = 60 * 1000; const CACHE_TIME = 60 * 1000; - - - -export function useGridIntersection(caseUuid: string | null, ensembleName: string | null, gridName: string | null, parameterName: string | null, realization: string | null, useStatistics: boolean): UseQueryResult { +export function useGridIntersection( + caseUuid: string | null, + ensembleName: string | null, + gridName: string | null, + parameterName: string | null, + realization: string | null, + useStatistics: boolean +): UseQueryResult { return useQuery({ queryKey: ["gridParameterIntersection", caseUuid, ensembleName, gridName, parameterName, realization], - queryFn: () => apiService.grid.gridParameterIntersection(caseUuid ?? "", ensembleName ?? "", gridName ?? "", parameterName ?? "", realization ?? ""), + queryFn: () => + apiService.grid.gridParameterIntersection( + caseUuid ?? "", + ensembleName ?? "", + gridName ?? "", + parameterName ?? "", + realization ?? "" + ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName && gridName && parameterName && realization && !useStatistics ? true : false, }); } -export function useStatisticalGridIntersection(caseUuid: string | null, ensembleName: string | null, gridName: string | null, parameterName: string | null, realizations: string[] | null, useStatistics: boolean): UseQueryResult { +export function useStatisticalGridIntersection( + caseUuid: string | null, + ensembleName: string | null, + gridName: string | null, + parameterName: string | null, + realizations: string[] | null, + useStatistics: boolean +): UseQueryResult { return useQuery({ - queryKey: ["statisticalGridParameterIntersection", caseUuid, ensembleName, gridName, parameterName, realizations], - queryFn: () => apiService.grid.statisticalGridParameterIntersection(caseUuid ?? "", ensembleName ?? "", gridName ?? "", parameterName ?? "", realizations ?? []), + queryKey: [ + "statisticalGridParameterIntersection", + caseUuid, + ensembleName, + gridName, + parameterName, + realizations, + ], + queryFn: () => + apiService.grid.statisticalGridParameterIntersection( + caseUuid ?? "", + ensembleName ?? "", + gridName ?? "", + parameterName ?? "", + realizations ?? [] + ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName && gridName && parameterName && realizations && useStatistics ? true : false, }); } - export function useGridModelNames(caseUuid: string | null, ensembleName: string | null): UseQueryResult { return useQuery({ queryKey: ["getGridModelNames", caseUuid, ensembleName], queryFn: () => apiService.grid.getGridModelNames(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } -export function useGridParameterNames(caseUuid: string | null, ensembleName: string | null, gridName: string | null): UseQueryResult { +export function useGridParameterNames( + caseUuid: string | null, + ensembleName: string | null, + gridName: string | null +): UseQueryResult { return useQuery({ queryKey: ["getParameterNames", caseUuid, ensembleName, gridName], queryFn: () => apiService.grid.getParameterNames(caseUuid ?? "", ensembleName ?? "", gridName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName && gridName ? true : false, }); } diff --git a/frontend/src/modules/InplaceVolumetrics/queryHooks.tsx b/frontend/src/modules/InplaceVolumetrics/queryHooks.tsx index 4f0fa9981..172ff3151 100644 --- a/frontend/src/modules/InplaceVolumetrics/queryHooks.tsx +++ b/frontend/src/modules/InplaceVolumetrics/queryHooks.tsx @@ -16,7 +16,7 @@ export function useEnsemblesQuery(caseUuid: string | null): UseQueryResult apiService.explore.getEnsembles(caseUuid ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid ? true : false, }); } @@ -28,12 +28,12 @@ export function useTableDescriptionsQuery( return useQuery({ queryKey: ["getTableNamesAndDescriptions", ensemble], queryFn: () => - apiService.inplaceVolumetrics.getTableNamesAndDescriptions( + apiService.inplaceVolumetrics.getTableNamesAndMetadata( ensemble?.getCaseUuid() ?? "", ensemble?.getEnsembleName() ?? "" ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: allowEnable && ensemble ? true : false, }); } @@ -57,7 +57,7 @@ export function useRealizationsResponseQuery( requestBody ?? {} ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: allowEnable && caseUuid && ensembleName && tableName && responseName ? true : false, }); } diff --git a/frontend/src/modules/Pvt/queryHooks.ts b/frontend/src/modules/Pvt/queryHooks.ts index 7868944c4..8f073f201 100644 --- a/frontend/src/modules/Pvt/queryHooks.ts +++ b/frontend/src/modules/Pvt/queryHooks.ts @@ -14,7 +14,7 @@ export function usePvtDataQuery( queryKey: ["tableData", caseUuid, ensembleName, realization], queryFn: () => apiService.pvt.tableData(caseUuid ?? "", ensembleName ?? "", realization ?? 0), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName && realization != null ? true : false, }); } diff --git a/frontend/src/modules/SimulationTimeSeries/queryHooks.tsx b/frontend/src/modules/SimulationTimeSeries/queryHooks.tsx index 84da421bc..e4e3dbf22 100644 --- a/frontend/src/modules/SimulationTimeSeries/queryHooks.tsx +++ b/frontend/src/modules/SimulationTimeSeries/queryHooks.tsx @@ -14,7 +14,7 @@ export function useVectorListQuery( queryKey: ["getVectorList", caseUuid, ensembleName], queryFn: () => apiService.timeseries.getVectorList(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } @@ -46,7 +46,7 @@ export function useVectorDataQuery( realizationsToInclude ?? undefined ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!(allowEnable && caseUuid && ensembleName && vectorName && allOrNonEmptyRealArr), }); } @@ -79,7 +79,7 @@ export function useStatisticalVectorDataQuery( realizationsToInclude ?? undefined ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!(allowEnable && caseUuid && ensembleName && vectorName && resampleFrequency && allOrNonEmptyRealArr), }); } @@ -101,7 +101,7 @@ export function useHistoricalVectorDataQuery( resampleFrequency ?? Frequency_api.MONTHLY ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!(allowEnable && caseUuid && ensembleName && nonHistoricalVectorName && resampleFrequency), }); } diff --git a/frontend/src/modules/SimulationTimeSeriesMatrix/queryHooks.tsx b/frontend/src/modules/SimulationTimeSeriesMatrix/queryHooks.tsx index 32959b418..4e2c2c7a8 100644 --- a/frontend/src/modules/SimulationTimeSeriesMatrix/queryHooks.tsx +++ b/frontend/src/modules/SimulationTimeSeriesMatrix/queryHooks.tsx @@ -20,7 +20,7 @@ export function useVectorListQueries( queryFn: () => apiService.timeseries.getVectorList(item.getCaseUuid() ?? "", item.getEnsembleName() ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: item.getCaseUuid() && item.getEnsembleName() ? true : false, }; }), @@ -54,7 +54,7 @@ export function useVectorDataQueries( realizationsToInclude ?? undefined ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!( allowEnable && item.vectorName && @@ -93,7 +93,7 @@ export function useStatisticalVectorDataQueries( realizationsToInclude ?? undefined ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!( allowEnable && item.vectorName && @@ -129,7 +129,7 @@ export function useHistoricalVectorDataQueries( resampleFrequency ?? Frequency_api.MONTHLY ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!( allowEnable && item.vectorName && diff --git a/frontend/src/modules/SimulationTimeSeriesSensitivity/queryHooks.tsx b/frontend/src/modules/SimulationTimeSeriesSensitivity/queryHooks.tsx index 77b890abe..d76ddc414 100644 --- a/frontend/src/modules/SimulationTimeSeriesSensitivity/queryHooks.tsx +++ b/frontend/src/modules/SimulationTimeSeriesSensitivity/queryHooks.tsx @@ -19,7 +19,7 @@ export function useVectorListQuery( queryKey: ["getVectorList", caseUuid, ensembleName], queryFn: () => apiService.timeseries.getVectorList(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!(caseUuid && ensembleName), }); } @@ -50,7 +50,7 @@ export function useVectorDataQuery( realizationsToInclude ?? undefined ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!(caseUuid && ensembleName && vectorName && allOrNonEmptyRealArr), }); } @@ -73,7 +73,7 @@ export function useStatisticalVectorSensitivityDataQuery( undefined ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!(allowEnable && caseUuid && ensembleName && vectorName && resampleFrequency), }); } @@ -95,7 +95,7 @@ export function useHistoricalVectorDataQuery( resampleFrequency ?? Frequency_api.MONTHLY ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!(allowEnable && caseUuid && ensembleName && vectorName && resampleFrequency), }); } diff --git a/frontend/src/modules/SubsurfaceMap/queryHooks.tsx b/frontend/src/modules/SubsurfaceMap/queryHooks.tsx index a49fa6264..a4749126d 100644 --- a/frontend/src/modules/SubsurfaceMap/queryHooks.tsx +++ b/frontend/src/modules/SubsurfaceMap/queryHooks.tsx @@ -23,7 +23,7 @@ export function usePolygonDirectoryQuery( queryKey: ["getSurfacePolygonsDirectory", caseUuid, ensembleName], queryFn: () => apiService.surfacePolygons.getSurfacePolygonsDirectory(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: STALE_TIME, + gcTime: STALE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } @@ -33,7 +33,7 @@ export function useGetWellHeaders(caseUuid: string | undefined): UseQueryResult< queryKey: ["getWellHeaders", caseUuid], queryFn: () => apiService.well.getWellHeaders(caseUuid ?? ""), staleTime: STALE_TIME, - cacheTime: STALE_TIME, + gcTime: STALE_TIME, enabled: caseUuid ? true : false, }); } @@ -43,7 +43,7 @@ export function useGetWellTrajectories(wellUuids: string[] | undefined): UseQuer queryKey: ["getWellTrajectories", wellUuids], queryFn: () => apiService.well.getWellTrajectories(wellUuids ?? []), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: wellUuids ? true : false, }); } @@ -52,7 +52,7 @@ export function useGetFieldWellsTrajectories(caseUuid: string | undefined): UseQ queryKey: ["getFieldWellsTrajectories", caseUuid], queryFn: () => apiService.well.getFieldWellTrajectories(caseUuid ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid ? true : false, }); } @@ -139,7 +139,7 @@ export function usePropertySurfaceDataByQueryAddress( queryFn: queryFn, select: transformSurfaceData, staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: enabled, }); } @@ -178,6 +178,6 @@ export function usePolygonsDataQueryByAddress( polygonAddr.attribute ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, }); } diff --git a/frontend/src/modules/TimeSeriesParameterDistribution/queryHooks.tsx b/frontend/src/modules/TimeSeriesParameterDistribution/queryHooks.tsx index 89e5b8285..b39c07d2e 100644 --- a/frontend/src/modules/TimeSeriesParameterDistribution/queryHooks.tsx +++ b/frontend/src/modules/TimeSeriesParameterDistribution/queryHooks.tsx @@ -14,7 +14,7 @@ export function useVectorsQuery( queryKey: ["getVectorList", caseUuid, ensembleName], queryFn: () => apiService.timeseries.getVectorList(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } @@ -27,7 +27,7 @@ export function useTimestampsListQuery( queryKey: ["getTimestampsList", caseUuid, ensembleName], queryFn: () => apiService.timeseries.getTimestampsList(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } @@ -40,7 +40,7 @@ export function useGetParameterNamesQuery( queryKey: ["getParameterNamesAndDescription", caseUuid, ensembleName], queryFn: () => apiService.parameters.getParameterNamesAndDescription(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } @@ -54,7 +54,7 @@ export function useParameterQuery( queryKey: ["getParameter", caseUuid, ensembleName, parameterName], queryFn: () => apiService.parameters.getParameter(caseUuid ?? "", ensembleName ?? "", parameterName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName && parameterName ? true : false, }); } @@ -74,7 +74,7 @@ export function useVectorAtTimestampQuery( timestampUtcMs ?? 0 ), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: !!(caseUuid && ensembleName && vectorName && timestampUtcMs != null), }); } diff --git a/frontend/src/modules/WellCompletions/queryHooks.tsx b/frontend/src/modules/WellCompletions/queryHooks.tsx index 77e3689d0..972c5d019 100644 --- a/frontend/src/modules/WellCompletions/queryHooks.tsx +++ b/frontend/src/modules/WellCompletions/queryHooks.tsx @@ -15,7 +15,7 @@ export function useWellCompletionsQuery( queryFn: () => apiService.wellCompletions.getWellCompletionsData(caseUuid ?? "", ensembleName ?? "", realizationNumber), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } diff --git a/frontend/src/modules/WellCompletions/settings.tsx b/frontend/src/modules/WellCompletions/settings.tsx index c57ca179c..514906236 100644 --- a/frontend/src/modules/WellCompletions/settings.tsx +++ b/frontend/src/modules/WellCompletions/settings.tsx @@ -121,7 +121,7 @@ export const settings = ({ moduleContext, workbenchSession, workbenchServices }: React.useEffect( function handleQueryStateChange() { - if (wellCompletionsQuery.status === "loading" && wellCompletionsQuery.fetchStatus === "fetching") { + if (wellCompletionsQuery.isFetching) { setDataLoadingStatus(DataLoadingStatus.Loading); } else if (wellCompletionsQuery.status === "error") { setDataLoadingStatus(DataLoadingStatus.Error); diff --git a/frontend/src/modules/_shared/Surface/queryHooks.ts b/frontend/src/modules/_shared/Surface/queryHooks.ts index efbe7b05c..43d1e63d4 100644 --- a/frontend/src/modules/_shared/Surface/queryHooks.ts +++ b/frontend/src/modules/_shared/Surface/queryHooks.ts @@ -16,7 +16,7 @@ export function useSurfaceDirectoryQuery( queryKey: ["getSurfaceDirectory", caseUuid, ensembleName], queryFn: () => apiService.surface.getSurfaceDirectory(caseUuid ?? "", ensembleName ?? ""), staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, enabled: caseUuid && ensembleName ? true : false, }); } @@ -90,6 +90,6 @@ export function useSurfaceDataQueryByAddress(surfAddr: SurfaceAddress | null): U queryFn: queryFn, select: transformSurfaceData, staleTime: STALE_TIME, - cacheTime: CACHE_TIME, + gcTime: CACHE_TIME, }); }