From fd8dd5631a1c52d8b59e57796d77b61c82f64a3c Mon Sep 17 00:00:00 2001 From: Andrei Nenashev Date: Thu, 26 Oct 2023 18:52:48 +0200 Subject: [PATCH] dependencies: upgrade react-query from 4 to 5 --- odd-platform-ui/package.json | 2 +- odd-platform-ui/pnpm-lock.yaml | 19 +++++++------- .../DatasetStructureCompare.tsx | 6 ++++- .../DatasetFieldInternalNameForm.tsx | 2 +- .../AssignFieldTermForm.tsx | 4 +-- .../EditLinkForm/EditLinkForm.tsx | 4 +-- .../SaveFilesForm/SaveFilesForm.tsx | 6 ++--- .../SaveLinksForm/SaveLinksForm.tsx | 4 +-- .../OverviewEntityGroupItems.tsx | 2 +- .../DataSourceList/DataSourceList.tsx | 6 ++++- .../Directory/Directory/Directory.tsx | 6 ++++- .../Directory/Entities/Entities.tsx | 4 +-- .../Entities/EntitiesList/EntitiesList.tsx | 4 +-- .../elements/AppErrorPage/AppErrorPage.tsx | 3 +-- .../StatusSettingsForm/StatusSettingsForm.tsx | 2 +- odd-platform-ui/src/index.tsx | 10 +++---- .../src/lib/hooks/api/dataEntity.ts | 26 ++++++++++++++----- .../dataEntityAttachments/dataEntityFiles.ts | 6 ++--- .../dataEntityAttachments/dataEntityLinks.ts | 6 ++--- .../src/lib/hooks/api/datasetField.ts | 6 ++--- .../src/lib/hooks/api/directory.ts | 13 +++++++--- odd-platform-ui/src/lib/hooks/api/terms.ts | 7 ++--- odd-platform-ui/src/lib/interfaces/shared.ts | 2 +- .../src/redux/lib/handleResponseThunk.ts | 2 +- 24 files changed, 90 insertions(+), 62 deletions(-) diff --git a/odd-platform-ui/package.json b/odd-platform-ui/package.json index 319f9dffb..97169df38 100644 --- a/odd-platform-ui/package.json +++ b/odd-platform-ui/package.json @@ -45,7 +45,7 @@ "@mui/system": "^5.14.4", "@mui/x-date-pickers": "^5.0.20", "@reduxjs/toolkit": "^1.9.5", - "@tanstack/react-query": "^4.32.6", + "@tanstack/react-query": "^5.0.5", "@tanstack/react-virtual": "3.0.0-beta.60", "@uiw/react-md-editor": "^3.23.5", "@visx/curve": "^3.3.0", diff --git a/odd-platform-ui/pnpm-lock.yaml b/odd-platform-ui/pnpm-lock.yaml index bae85e1d3..a6c541b58 100644 --- a/odd-platform-ui/pnpm-lock.yaml +++ b/odd-platform-ui/pnpm-lock.yaml @@ -28,8 +28,8 @@ dependencies: specifier: ^1.9.5 version: 1.9.5(react-redux@8.1.2)(react@18.2.0) '@tanstack/react-query': - specifier: ^4.32.6 - version: 4.32.6(react-dom@18.2.0)(react@18.2.0) + specifier: ^5.0.5 + version: 5.0.5(react-dom@18.2.0)(react@18.2.0) '@tanstack/react-virtual': specifier: 3.0.0-beta.60 version: 3.0.0-beta.60(react@18.2.0) @@ -1449,15 +1449,15 @@ packages: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true - /@tanstack/query-core@4.32.6: - resolution: {integrity: sha512-YVB+mVWENQwPyv+40qO7flMgKZ0uI41Ph7qXC2Zf1ft5AIGfnXnMZyifB2ghhZ27u+5wm5mlzO4Y6lwwadzxCA==} + /@tanstack/query-core@5.0.5: + resolution: {integrity: sha512-MThCETMkHDHTnFZHp71L+SqTtD5d6XHftFCVR1xRJdWM3qGrlQ2VCXaj0SKVcyJej2e1Opa2c7iknu1llxCDNQ==} dev: false - /@tanstack/react-query@4.32.6(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-AITu/IKJJJXsHHeXNBy5bclu12t08usMCY0vFC2dh9SP/w6JAk5U9GwfjOIPj3p+ATADZvxQPe8UiCtMLNeQbg==} + /@tanstack/react-query@5.0.5(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-ZG0Q4HZ0iuI8mWiZ2/MdVYPHbrmAVhMn7+gLOkxJh6zLIgCL4luSZlohzN5Xt4MjxfxxWioO1nemwpudaTsmQg==} 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: react-dom: @@ -1465,10 +1465,9 @@ packages: react-native: optional: true dependencies: - '@tanstack/query-core': 4.32.6 + '@tanstack/query-core': 5.0.5 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - use-sync-external-store: 1.2.0(react@18.2.0) dev: false /@tanstack/react-virtual@3.0.0-beta.60(react@18.2.0): diff --git a/odd-platform-ui/src/components/DataEntityDetails/DatasetStructure/DatasetStructureCompare/DatasetStructureCompare.tsx b/odd-platform-ui/src/components/DataEntityDetails/DatasetStructure/DatasetStructureCompare/DatasetStructureCompare.tsx index ac3b7dfeb..9c3586a5b 100644 --- a/odd-platform-ui/src/components/DataEntityDetails/DatasetStructure/DatasetStructureCompare/DatasetStructureCompare.tsx +++ b/odd-platform-ui/src/components/DataEntityDetails/DatasetStructure/DatasetStructureCompare/DatasetStructureCompare.tsx @@ -43,7 +43,11 @@ const DatasetStructureCompare: FC = () => { /> )} {isLoading && } - + = ({ datasetFieldId, handleAddTerm, }) => { - const { isLoading, isSuccess, mutateAsync: addTerm } = useAddDatasetFieldTerm(); + const { isPending, isSuccess, mutateAsync: addTerm } = useAddDatasetFieldTerm(); const onSubmit = useCallback( (clearState: () => void) => @@ -32,7 +32,7 @@ const AssignFieldTermForm: FC = ({ onSubmit={onSubmit} openBtnEl={openBtnEl} handleCloseSubmittedForm={isSuccess} - isLoading={isLoading} + isLoading={isPending} /> ); }; diff --git a/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/EditLinkForm/EditLinkForm.tsx b/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/EditLinkForm/EditLinkForm.tsx index f99bb634e..5e77e04a2 100644 --- a/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/EditLinkForm/EditLinkForm.tsx +++ b/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/EditLinkForm/EditLinkForm.tsx @@ -18,7 +18,7 @@ const EditLinkForm: FC = ({ openBtn, linkId, name, url }) => const { t } = useTranslation(); const { dataEntityId } = useAppParams(); - const { mutate: updateLink, isLoading, isSuccess } = useUpdateDataEntityLink(); + const { mutate: updateLink, isPending, isSuccess } = useUpdateDataEntityLink(); const { reset, formState, handleSubmit, control } = useForm({ defaultValues: { name, url }, @@ -90,7 +90,7 @@ const EditLinkForm: FC = ({ openBtn, linkId, name, url }) => renderContent={formContent} renderActions={formActionButtons} handleCloseSubmittedForm={isSuccess} - isLoading={isLoading} + isLoading={isPending} clearState={clearState} /> ); diff --git a/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/SaveFilesForm/SaveFilesForm.tsx b/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/SaveFilesForm/SaveFilesForm.tsx index 24345fe0d..eaff1cd0d 100644 --- a/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/SaveFilesForm/SaveFilesForm.tsx +++ b/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/SaveFilesForm/SaveFilesForm.tsx @@ -18,7 +18,7 @@ const SaveFilesForm: FC = ({ openBtn, maxSize }) => { const formId = 'save-files-form'; const { dataEntityId } = useAppParams(); - const { mutate: saveFile, isLoading, isSuccess } = useSaveDataEntityFile(); + const { mutate: saveFile, isPending, isSuccess } = useSaveDataEntityFile(); const [uploadedFile, setUploadedFile] = useState(undefined); const { reset, handleSubmit, control } = useForm({ @@ -92,7 +92,7 @@ const SaveFilesForm: FC = ({ openBtn, maxSize }) => { type='submit' form={formId} fullWidth - disabled={!uploadedFile || isLoading} + disabled={!uploadedFile || isPending} /> ); @@ -106,7 +106,7 @@ const SaveFilesForm: FC = ({ openBtn, maxSize }) => { renderContent={formContent} renderActions={formActionButtons} handleCloseSubmittedForm={isSuccess} - isLoading={isLoading} + isLoading={isPending} clearState={clearState} confirmOnClose /> diff --git a/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/SaveLinksForm/SaveLinksForm.tsx b/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/SaveLinksForm/SaveLinksForm.tsx index 74e19897f..9f0b86dd8 100644 --- a/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/SaveLinksForm/SaveLinksForm.tsx +++ b/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewAttachments/SaveLinksForm/SaveLinksForm.tsx @@ -15,7 +15,7 @@ const SaveLinksForm: FC = ({ openBtn }) => { const formId = 'save-links-form'; const { dataEntityId } = useAppParams(); - const { mutate: saveLinks, isLoading, isSuccess } = useSaveDataEntityLinks(); + const { mutate: saveLinks, isPending, isSuccess } = useSaveDataEntityLinks(); const methods = useForm({ defaultValues: { items: [{ name: '', url: '' }] }, @@ -87,7 +87,7 @@ const SaveLinksForm: FC = ({ openBtn }) => { renderContent={formContent} renderActions={formActionButtons} handleCloseSubmittedForm={isSuccess} - isLoading={isLoading} + isLoading={isPending} clearState={clearState} /> ); diff --git a/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewStats/OverviewEntityGroupItems/OverviewEntityGroupItems.tsx b/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewStats/OverviewEntityGroupItems/OverviewEntityGroupItems.tsx index 30d3ba4f7..ac31ca7a9 100644 --- a/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewStats/OverviewEntityGroupItems/OverviewEntityGroupItems.tsx +++ b/odd-platform-ui/src/components/DataEntityDetails/Overview/OverviewStats/OverviewEntityGroupItems/OverviewEntityGroupItems.tsx @@ -106,7 +106,7 @@ const OverviewEntityGroupItems: FC = () => { scrollableTarget='entity-group-items-list' dataLength={entities.length} next={fetchNextPage} - hasMore={!!hasNextPage} + hasMore={hasNextPage} loader={ diff --git a/odd-platform-ui/src/components/Directory/DataSourceList/DataSourceList.tsx b/odd-platform-ui/src/components/Directory/DataSourceList/DataSourceList.tsx index d381b0083..41f7a779f 100644 --- a/odd-platform-ui/src/components/Directory/DataSourceList/DataSourceList.tsx +++ b/odd-platform-ui/src/components/Directory/DataSourceList/DataSourceList.tsx @@ -106,7 +106,11 @@ const DataSourceList: FC = () => { return ( <> {isLoading && } - + {dataSourceList && ( diff --git a/odd-platform-ui/src/components/Directory/Directory/Directory.tsx b/odd-platform-ui/src/components/Directory/Directory/Directory.tsx index 19adb4da0..063c05b9b 100644 --- a/odd-platform-ui/src/components/Directory/Directory/Directory.tsx +++ b/odd-platform-ui/src/components/Directory/Directory/Directory.tsx @@ -27,7 +27,11 @@ const Directory: FC = () => { {t('Directories')} {isLoading && } - + {dataSourceTypes && ( diff --git a/odd-platform-ui/src/components/Directory/Entities/Entities.tsx b/odd-platform-ui/src/components/Directory/Entities/Entities.tsx index db1ba14cc..245a607d8 100644 --- a/odd-platform-ui/src/components/Directory/Entities/Entities.tsx +++ b/odd-platform-ui/src/components/Directory/Entities/Entities.tsx @@ -60,7 +60,7 @@ const Entities: FC = () => { @@ -80,7 +80,7 @@ const Entities: FC = () => { {types && } Promise< - InfiniteQueryObserverResult + InfiniteQueryObserverResult, ErrorState> >; } diff --git a/odd-platform-ui/src/components/shared/elements/AppErrorPage/AppErrorPage.tsx b/odd-platform-ui/src/components/shared/elements/AppErrorPage/AppErrorPage.tsx index 269529e9c..aa2e5f42b 100644 --- a/odd-platform-ui/src/components/shared/elements/AppErrorPage/AppErrorPage.tsx +++ b/odd-platform-ui/src/components/shared/elements/AppErrorPage/AppErrorPage.tsx @@ -10,7 +10,6 @@ interface AppErrorPageProps { error?: ErrorState; offsetTop?: number; } - const AppErrorPage: React.FC = ({ showError, error, @@ -27,7 +26,7 @@ const AppErrorPage: React.FC = ({ - {error?.statusText || t('Unknown Error')} + {error?.statusText ?? t('Unknown Error')} {t('Return to the')}