From ed06afc74b4a657fcdb7c6cb0b617e97808a38f1 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 16 Jan 2025 11:56:16 -0300 Subject: [PATCH 01/34] update package --- package.json | 2 +- yarn.lock | 44 ++++++++++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index aa67f4b903..960c7d406a 100644 --- a/package.json +++ b/package.json @@ -210,7 +210,7 @@ "react-redux": "5.0.6", "react-redux-form": "^1.16.14", "react-render-if-visible": "^2.1.1", - "react-router-dom": "6.27.0", + "react-router-dom": "^7.1.1", "react-table": "^7.8.0", "react-table-sticky": "^1.1.3", "react-tabs": "^6.1.0", diff --git a/yarn.lock b/yarn.lock index b679f0f572..19c76a81c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3038,11 +3038,6 @@ resolved "https://registry.yarnpkg.com/@react-dnd/shallowequal/-/shallowequal-4.0.2.tgz#d1b4befa423f692fa4abf1c79209702e7d8ae4b4" integrity sha512-/RVXdLvJxLg4QKvMoM5WlwNR9ViO9z8B/qPcc+C0Sa/teJY7QG7kJ441DwzOjMYEY7GmU4dj5EcGHIkKZiQZCA== -"@remix-run/router@1.20.0": - version "1.20.0" - resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.20.0.tgz#03554155b45d8b529adf635b2f6ad1165d70d8b4" - integrity sha512-mUnk8rPJBI9loFDZ+YzPGdeniYK+FTmRD1TMCz7ev2SNIozyKKpnGgsxO34u6Z4z/t0ITuu7voi/AshfsGsgFg== - "@remix-run/router@1.21.0": version "1.21.0" resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.21.0.tgz#c65ae4262bdcfe415dbd4f64ec87676e4a56e2b5" @@ -6913,6 +6908,11 @@ cookie@0.7.2: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== +cookie@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.0.2.tgz#27360701532116bd3f1f9416929d176afe1e4610" + integrity sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA== + cookie@~0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" @@ -14427,20 +14427,22 @@ react-render-if-visible@^2.1.1: resolved "https://registry.yarnpkg.com/react-render-if-visible/-/react-render-if-visible-2.1.1.tgz#b67d8a6d230d8e1e8986212a1d4098425a26810b" integrity sha512-dl6OZkF+ktKi/pMNt5Upn99gSWnOCAQdFp/WBclMsPs4dV/RLeE40lab8tixoHB4UEKsspv0jFR13HF4fxmPHw== -react-router-dom@6.27.0: - version "6.27.0" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.27.0.tgz#8d7972a425fd75f91c1e1ff67e47240c5752dc3f" - integrity sha512-+bvtFWMC0DgAFrfKXKG9Fc+BcXWRUO1aJIihbB79xaeq0v5UzfvnM5houGUm1Y461WVRcgAQ+Clh5rdb1eCx4g== +react-router-dom@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-7.1.1.tgz#9e76fb63a762ba5da13032f5fd9e4a24946396b6" + integrity sha512-vSrQHWlJ5DCfyrhgo0k6zViOe9ToK8uT5XGSmnuC2R3/g261IdIMpZVqfjD6vWSXdnf5Czs4VA/V60oVR6/jnA== dependencies: - "@remix-run/router" "1.20.0" - react-router "6.27.0" + react-router "7.1.1" -react-router@6.27.0: - version "6.27.0" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.27.0.tgz#db292474926c814c996c0ff3ef0162d1f9f60ed4" - integrity sha512-YA+HGZXz4jaAkVoYBE98VQl+nVzI+cVI2Oj/06F5ZM+0u3TgedN9Y9kmMRo2mnkSK2nCpNQn0DVob4HCsY/WLw== +react-router@7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-7.1.1.tgz#88f5657fa5b8f0b918c7222ec710de0274d00b2e" + integrity sha512-39sXJkftkKWRZ2oJtHhCxmoCrBCULr/HAH4IT5DHlgu/Q0FCPV0S4Lx+abjDTx/74xoZzNYDYbOZWlJjruyuDQ== dependencies: - "@remix-run/router" "1.20.0" + "@types/cookie" "^0.6.0" + cookie "^1.0.1" + set-cookie-parser "^2.6.0" + turbo-stream "2.4.0" react-shallow-renderer@^16.15.0: version "16.15.0" @@ -15240,6 +15242,11 @@ serve-static@1.16.2: parseurl "~1.3.3" send "0.19.0" +set-cookie-parser@^2.6.0: + version "2.7.1" + resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz#3016f150072202dfbe90fadee053573cc89d2943" + integrity sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ== + set-function-length@^1.2.1, set-function-length@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" @@ -16440,6 +16447,11 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" +turbo-stream@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/turbo-stream/-/turbo-stream-2.4.0.tgz#1e4fca6725e90fa14ac4adb782f2d3759a5695f0" + integrity sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g== + tween-functions@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/tween-functions/-/tween-functions-1.2.0.tgz#1ae3a50e7c60bb3def774eac707acbca73bbc3ff" From e052ca798665fbaabec04e53b0ab1de1b9a1d121 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 16 Jan 2025 12:09:59 -0300 Subject: [PATCH 02/34] update package to new name --- package.json | 2 +- yarn.lock | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 960c7d406a..889a18935c 100644 --- a/package.json +++ b/package.json @@ -210,7 +210,7 @@ "react-redux": "5.0.6", "react-redux-form": "^1.16.14", "react-render-if-visible": "^2.1.1", - "react-router-dom": "^7.1.1", + "react-router": "^7.1.1", "react-table": "^7.8.0", "react-table-sticky": "^1.1.3", "react-tabs": "^6.1.0", diff --git a/yarn.lock b/yarn.lock index 19c76a81c1..ef79dd5dc6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14427,14 +14427,7 @@ react-render-if-visible@^2.1.1: resolved "https://registry.yarnpkg.com/react-render-if-visible/-/react-render-if-visible-2.1.1.tgz#b67d8a6d230d8e1e8986212a1d4098425a26810b" integrity sha512-dl6OZkF+ktKi/pMNt5Upn99gSWnOCAQdFp/WBclMsPs4dV/RLeE40lab8tixoHB4UEKsspv0jFR13HF4fxmPHw== -react-router-dom@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-7.1.1.tgz#9e76fb63a762ba5da13032f5fd9e4a24946396b6" - integrity sha512-vSrQHWlJ5DCfyrhgo0k6zViOe9ToK8uT5XGSmnuC2R3/g261IdIMpZVqfjD6vWSXdnf5Czs4VA/V60oVR6/jnA== - dependencies: - react-router "7.1.1" - -react-router@7.1.1: +react-router@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/react-router/-/react-router-7.1.1.tgz#88f5657fa5b8f0b918c7222ec710de0274d00b2e" integrity sha512-39sXJkftkKWRZ2oJtHhCxmoCrBCULr/HAH4IT5DHlgu/Q0FCPV0S4Lx+abjDTx/74xoZzNYDYbOZWlJjruyuDQ== From 3702a25e65c765bcae979bc5c6c5a88df5a9fea5 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 16 Jan 2025 12:15:32 -0300 Subject: [PATCH 03/34] remove @remix-run/router --- package.json | 1 - yarn.lock | 5 ----- 2 files changed, 6 deletions(-) diff --git a/package.json b/package.json index 889a18935c..65d2fc14b4 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,6 @@ "@huridocs/react-text-selection-handler": "^0.3.0", "@loadable/component": "^5.16.4", "@popperjs/core": "^2.11.8", - "@remix-run/router": "1.21.0", "@sentry/node": "^7.114.0", "@sentry/react": "7.114.0", "@sentry/tracing": "^7.114.0", diff --git a/yarn.lock b/yarn.lock index ef79dd5dc6..bd1ad82017 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3038,11 +3038,6 @@ resolved "https://registry.yarnpkg.com/@react-dnd/shallowequal/-/shallowequal-4.0.2.tgz#d1b4befa423f692fa4abf1c79209702e7d8ae4b4" integrity sha512-/RVXdLvJxLg4QKvMoM5WlwNR9ViO9z8B/qPcc+C0Sa/teJY7QG7kJ441DwzOjMYEY7GmU4dj5EcGHIkKZiQZCA== -"@remix-run/router@1.21.0": - version "1.21.0" - resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.21.0.tgz#c65ae4262bdcfe415dbd4f64ec87676e4a56e2b5" - integrity sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA== - "@rtsao/scc@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@rtsao/scc/-/scc-1.1.0.tgz#927dd2fae9bc3361403ac2c7a00c32ddce9ad7e8" From 3883fb4ff89f3e20bb2d827cd410c1df31ce5416 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 16 Jan 2025 12:20:30 -0300 Subject: [PATCH 04/34] bulk update imports, types, mocks --- app/react/App/App.js | 2 +- app/react/App/Menu.tsx | 2 +- app/react/App/specs/Menu.spec.js | 4 ++-- .../Attachments/components/ViewDocumentLink.tsx | 2 +- .../components/specs/ViewDocumentLink.spec.tsx | 6 +++--- app/react/Forms/components/MultiSelect.tsx | 2 +- app/react/I18N/components/I18NLink.tsx | 2 +- app/react/I18N/components/I18NMenu.tsx | 2 +- app/react/I18N/components/specs/I18NLink.spec.js | 2 +- app/react/I18N/components/specs/I18NMenu.spec.tsx | 2 +- app/react/Layout/CurrentLocationLink.js | 2 +- app/react/Layout/DocumentsList.js | 2 +- app/react/Layout/specs/CurrentLocationLink.spec.js | 4 ++-- app/react/Library/components/DocumentTypesList.js | 2 +- .../Library/components/FiltersFromProperties.js | 2 +- app/react/Library/components/SearchBar.tsx | 2 +- app/react/Library/components/SortDropdown.tsx | 2 +- .../components/specs/FiltersFromProperties.spec.js | 4 ++-- app/react/Map/specs/LMap.spec.tsx | 4 ++-- app/react/Markdown/components/MarkdownLink.js | 2 +- app/react/Markdown/components/PayPalDonateLink.js | 2 +- app/react/Markdown/components/SearchBox.js | 2 +- app/react/Markdown/components/index.js | 2 +- .../Markdown/components/specs/MarkdownLink.spec.js | 4 ++-- .../components/specs/PayPalDonateLink.spec.js | 4 ++-- .../Markdown/components/specs/SearchBox.spec.js | 4 ++-- app/react/ProtectedRoute.tsx | 2 +- app/react/Routes.tsx | 2 +- app/react/Settings/Settings.js | 2 +- app/react/Settings/components/EntityTypesList.js | 2 +- .../components/specs/EntityTypesList.spec.js | 4 ++-- .../components/specs/MetadataTemplate.spec.js | 4 +--- app/react/V2/Components/Analitycs/Matomo.tsx | 2 +- .../V2/Components/Analitycs/specs/Matomo.spec.tsx | 2 +- .../V2/Components/ErrorHandling/GeneralError.tsx | 2 +- .../Components/ErrorHandling/RouteErrorBoundary.tsx | 2 +- .../ErrorHandling/specs/GeneralError.spec.tsx | 4 ++-- .../ErrorHandling/specs/RouteErrorBoundary.spec.tsx | 4 ++-- .../Components/Layouts/specs/SettingsContent.cy.tsx | 2 +- app/react/V2/Components/UI/Paginator.tsx | 2 +- app/react/V2/Components/UI/Sidepanel.tsx | 2 +- app/react/V2/Routes/Settings/Account/Account.tsx | 2 +- .../Settings/Account/Components/TwoFactorSetup.tsx | 2 +- .../V2/Routes/Settings/ActivityLog/ActivityLog.tsx | 2 +- .../Routes/Settings/ActivityLog/ActivityLogLoader.ts | 2 +- .../V2/Routes/Settings/Collection/Collection.tsx | 2 +- .../Routes/Settings/CustomUploads/CustomUploads.tsx | 2 +- .../CustomUploads/components/DropzoneModal.tsx | 2 +- .../CustomUploads/components/EditFileSidepanel.tsx | 2 +- .../Routes/Settings/Customization/Customization.tsx | 2 +- app/react/V2/Routes/Settings/Dashboard/Dashboard.tsx | 2 +- .../V2/Routes/Settings/Filters/FiltersTable.tsx | 2 +- .../Settings/Filters/components/FiltersSidepanel.tsx | 2 +- app/react/V2/Routes/Settings/IX/IXDashboard.tsx | 2 +- app/react/V2/Routes/Settings/IX/IXSuggestions.tsx | 2 +- .../Settings/IX/components/FiltersSidepanel.tsx | 2 +- .../Routes/Settings/IX/components/SuggestedValue.tsx | 2 +- .../Routes/Settings/IX/components/TableElements.tsx | 2 +- .../V2/Routes/Settings/Languages/LanguagesList.tsx | 2 +- .../V2/Routes/Settings/MenuConfig/MenuConfig.tsx | 2 +- app/react/V2/Routes/Settings/Pages/PageEditor.tsx | 2 +- app/react/V2/Routes/Settings/Pages/PagesList.tsx | 2 +- .../Pages/components/PageEditorComponents.tsx | 2 +- .../Settings/Pages/components/PageListTable.tsx | 2 +- .../Settings/ParagraphExtraction/PXEntities.tsx | 2 +- .../Settings/ParagraphExtraction/PXParagraphs.tsx | 2 +- .../ParagraphExtraction/ParagraphExtraction.tsx | 2 +- .../components/ExtractorModal.tsx | 2 +- .../components/PXEntityTableElements.tsx | 2 +- .../components/PXTableElements.tsx | 2 +- .../ParagraphExtraction/components/ViewParagraph.tsx | 2 +- .../Settings/RelationshipTypes/RelationshipTypes.tsx | 2 +- .../V2/Routes/Settings/Thesauri/EditThesaurus.tsx | 2 +- .../V2/Routes/Settings/Thesauri/ThesauriList.tsx | 2 +- .../V2/Routes/Settings/Thesauri/ThesaurusForm.tsx | 2 +- .../Settings/Thesauri/components/ThesauriTable.tsx | 2 +- .../Thesauri/components/ThesaurusActions.tsx | 2 +- app/react/V2/Routes/Settings/Thesauri/helpers.ts | 2 +- .../Routes/Settings/Thesauri/specs/Thesauri.spec.tsx | 2 +- .../Settings/Translations/EditTranslations.tsx | 2 +- .../Settings/Translations/TranslationsList.tsx | 2 +- .../Translations/components/TableComponents.tsx | 2 +- app/react/V2/Routes/Settings/Users/Users.tsx | 2 +- .../Settings/Users/components/GroupFormSidepanel.tsx | 2 +- .../Settings/Users/components/UserFormSidepanel.tsx | 2 +- .../Routes/Settings/Users/useHandleNotifications.tsx | 2 +- app/react/V2/api/translations/index.ts | 2 +- app/react/Viewer/components/Paginator.js | 2 +- app/react/Viewer/components/specs/Paginator.spec.js | 4 ++-- app/react/Viewer/specs/PDFView.spec.js | 4 ++-- app/react/componentWrappers.tsx | 2 +- app/react/entry-client.tsx | 2 +- app/react/entry-server.tsx | 12 ++++++++---- app/react/getIndexElement.tsx | 2 +- app/react/stories/Paginator.stories.tsx | 2 +- app/react/utils/api.js | 2 +- app/react/utils/routeHelpers.ts | 2 +- app/react/utils/specs/api.spec.js | 4 ++-- 98 files changed, 120 insertions(+), 118 deletions(-) diff --git a/app/react/App/App.js b/app/react/App/App.js index 05d22199c6..39e706e3f0 100644 --- a/app/react/App/App.js +++ b/app/react/App/App.js @@ -1,7 +1,7 @@ /* eslint-disable import/no-named-as-default */ import React, { useState, useMemo } from 'react'; import PropTypes from 'prop-types'; -import { Outlet, useLocation, useParams } from 'react-router-dom'; +import { Outlet, useLocation, useParams } from 'react-router'; import { useAtom } from 'jotai'; import Notifications from 'app/Notifications'; import Cookiepopup from 'app/App/Cookiepopup'; diff --git a/app/react/App/Menu.tsx b/app/react/App/Menu.tsx index a4abf9cbd6..1efa8b303f 100644 --- a/app/react/App/Menu.tsx +++ b/app/react/App/Menu.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useLocation } from 'react-router-dom'; +import { useLocation } from 'react-router'; import { bindActionCreators, Dispatch } from 'redux'; import { connect, ConnectedProps } from 'react-redux'; import { fromJS } from 'immutable'; diff --git a/app/react/App/specs/Menu.spec.js b/app/react/App/specs/Menu.spec.js index 4484bc637e..d2ee88c072 100644 --- a/app/react/App/specs/Menu.spec.js +++ b/app/react/App/specs/Menu.spec.js @@ -3,8 +3,8 @@ import { I18NLink } from 'app/I18N'; import { renderConnected } from 'app/utils/test/renderConnected'; import { Menu } from '../Menu'; -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useLocation: () => ({ search: '?q=(searchTerm:%27asd%27)', }), diff --git a/app/react/Attachments/components/ViewDocumentLink.tsx b/app/react/Attachments/components/ViewDocumentLink.tsx index 8d591f52ea..c0cdfa0af5 100644 --- a/app/react/Attachments/components/ViewDocumentLink.tsx +++ b/app/react/Attachments/components/ViewDocumentLink.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Link, useLocation } from 'react-router-dom'; +import { Link, useLocation } from 'react-router'; import { CurrentLocationLink } from 'app/Layout'; import { EntitySchema } from 'shared/types/entityType'; diff --git a/app/react/Attachments/components/specs/ViewDocumentLink.spec.tsx b/app/react/Attachments/components/specs/ViewDocumentLink.spec.tsx index b2fdfdd276..ead034137d 100644 --- a/app/react/Attachments/components/specs/ViewDocumentLink.spec.tsx +++ b/app/react/Attachments/components/specs/ViewDocumentLink.spec.tsx @@ -1,4 +1,4 @@ -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import React from 'react'; import { shallow } from 'enzyme'; @@ -13,8 +13,8 @@ const mockUseLocation = jest.fn().mockImplementation(() => ({ pathname: `?page=${pathname}`, })); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useLocation: () => mockUseLocation(), })); const renderComponent = (entity: EntitySchema) => { diff --git a/app/react/Forms/components/MultiSelect.tsx b/app/react/Forms/components/MultiSelect.tsx index e437a6cd93..fa48a910e9 100644 --- a/app/react/Forms/components/MultiSelect.tsx +++ b/app/react/Forms/components/MultiSelect.tsx @@ -1,7 +1,7 @@ /* eslint-disable max-classes-per-file */ /* eslint-disable class-methods-use-this,max-lines */ -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import ShowIf from 'app/App/ShowIf'; import { filterOptions } from 'shared/optionsUtils'; import { t, Translate } from 'app/I18N'; diff --git a/app/react/I18N/components/I18NLink.tsx b/app/react/I18N/components/I18NLink.tsx index 338747c73c..5841be31dc 100644 --- a/app/react/I18N/components/I18NLink.tsx +++ b/app/react/I18N/components/I18NLink.tsx @@ -1,6 +1,6 @@ import React, { useEffect } from 'react'; import { connect } from 'react-redux'; -import { useNavigate, NavLink, useLocation } from 'react-router-dom'; +import { useNavigate, NavLink, useLocation } from 'react-router'; import { omit } from 'lodash'; const defaultProps = { diff --git a/app/react/I18N/components/I18NMenu.tsx b/app/react/I18N/components/I18NMenu.tsx index 0e74a6e592..62ba9e50ac 100644 --- a/app/react/I18N/components/I18NMenu.tsx +++ b/app/react/I18N/components/I18NMenu.tsx @@ -9,7 +9,7 @@ import { actions, Translate, t } from 'app/I18N'; import { IStore } from 'app/istore'; import { NeedAuthorization } from 'app/Auth'; import { useOnClickOutsideElement } from 'app/utils/useOnClickOutsideElementHook'; -import { Location, useLocation } from 'react-router-dom'; +import { Location, useLocation } from 'react-router'; const locationSearch = (location: Location) => { const cleanSearch = location.search.split(/page=\d+|&page=\d+/).join(''); diff --git a/app/react/I18N/components/specs/I18NLink.spec.js b/app/react/I18N/components/specs/I18NLink.spec.js index 7f27c27261..6507c3b318 100644 --- a/app/react/I18N/components/specs/I18NLink.spec.js +++ b/app/react/I18N/components/specs/I18NLink.spec.js @@ -4,8 +4,8 @@ /* eslint-disable max-statements */ import React from 'react'; import { render, screen, fireEvent } from '@testing-library/react'; +import { MemoryRouter, Route, Routes } from 'react-router'; import { I18NLink } from '../I18NLink'; -import { MemoryRouter, Route, Routes } from 'react-router-dom'; describe('I18NLink', () => { let props; diff --git a/app/react/I18N/components/specs/I18NMenu.spec.tsx b/app/react/I18N/components/specs/I18NMenu.spec.tsx index f8cbb92073..2b214113b1 100644 --- a/app/react/I18N/components/specs/I18NMenu.spec.tsx +++ b/app/react/I18N/components/specs/I18NMenu.spec.tsx @@ -5,7 +5,7 @@ import React from 'react'; import { act, fireEvent, RenderResult, screen } from '@testing-library/react'; import { Provider } from 'react-redux'; import { MockStoreEnhanced } from 'redux-mock-store'; -import { Location, MemoryRouter } from 'react-router-dom'; +import { Location, MemoryRouter } from 'react-router'; import Immutable from 'immutable'; import { defaultState, renderConnectedContainer } from 'app/utils/test/renderConnected'; import { i18NMenuComponent as I18NMenu } from '../I18NMenu'; diff --git a/app/react/Layout/CurrentLocationLink.js b/app/react/Layout/CurrentLocationLink.js index c79893e946..d2d4dd0069 100644 --- a/app/react/Layout/CurrentLocationLink.js +++ b/app/react/Layout/CurrentLocationLink.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Link, useLocation } from 'react-router-dom'; +import { Link, useLocation } from 'react-router'; const validProps = props => { const { to, ...valid } = props; diff --git a/app/react/Layout/DocumentsList.js b/app/react/Layout/DocumentsList.js index 80347d1b24..7301476c9e 100644 --- a/app/react/Layout/DocumentsList.js +++ b/app/react/Layout/DocumentsList.js @@ -1,7 +1,7 @@ /* eslint-disable max-lines */ import PropTypes from 'prop-types'; import React, { Component } from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { toUrlParams } from 'shared/JSONRequest'; import rison from 'rison-node'; import { SearchBar } from 'app/Library/components/SearchBar'; diff --git a/app/react/Layout/specs/CurrentLocationLink.spec.js b/app/react/Layout/specs/CurrentLocationLink.spec.js index 24a7179137..b7faf931b3 100644 --- a/app/react/Layout/specs/CurrentLocationLink.spec.js +++ b/app/react/Layout/specs/CurrentLocationLink.spec.js @@ -2,8 +2,8 @@ import React from 'react'; import { shallow } from 'enzyme'; import { CurrentLocationLink } from '../CurrentLocationLink'; -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useLocation: () => ({ pathname: 'pathanem', search: 'param=value¶m2=value2' }), })); diff --git a/app/react/Library/components/DocumentTypesList.js b/app/react/Library/components/DocumentTypesList.js index 97dead0228..bb5a62e167 100644 --- a/app/react/Library/components/DocumentTypesList.js +++ b/app/react/Library/components/DocumentTypesList.js @@ -3,7 +3,7 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import Immutable, { is } from 'immutable'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import rison from 'rison-node'; import ShowIf from 'app/App/ShowIf'; import { withRouter } from 'app/componentWrappers'; diff --git a/app/react/Library/components/FiltersFromProperties.js b/app/react/Library/components/FiltersFromProperties.js index a882070574..6cc8f86a5a 100644 --- a/app/react/Library/components/FiltersFromProperties.js +++ b/app/react/Library/components/FiltersFromProperties.js @@ -1,6 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; -import { useLocation } from 'react-router-dom'; +import { useLocation } from 'react-router'; import rison from 'rison-node'; import Immutable from 'immutable'; import PropTypes from 'prop-types'; diff --git a/app/react/Library/components/SearchBar.tsx b/app/react/Library/components/SearchBar.tsx index a5b2fa4434..e8155c0000 100644 --- a/app/react/Library/components/SearchBar.tsx +++ b/app/react/Library/components/SearchBar.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { bindActionCreators, Dispatch } from 'redux'; import { actions as formActions } from 'react-redux-form'; import { connect, ConnectedProps } from 'react-redux'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useLocation, useNavigate } from 'react-router'; import { Icon } from 'UI'; import { diff --git a/app/react/Library/components/SortDropdown.tsx b/app/react/Library/components/SortDropdown.tsx index 59f43f5df3..977bb4c686 100644 --- a/app/react/Library/components/SortDropdown.tsx +++ b/app/react/Library/components/SortDropdown.tsx @@ -3,7 +3,7 @@ import { bindActionCreators, Dispatch } from 'redux'; import { connect, ConnectedProps } from 'react-redux'; import { actions } from 'react-redux-form'; import { risonDecodeOrIgnore } from 'app/utils'; -import { useLocation, useSearchParams } from 'react-router-dom'; +import { useLocation, useSearchParams } from 'react-router'; import { Icon } from 'UI'; import { I18NLink, t } from 'app/I18N'; import { wrapDispatch } from 'app/Multireducer'; diff --git a/app/react/Library/components/specs/FiltersFromProperties.spec.js b/app/react/Library/components/specs/FiltersFromProperties.spec.js index e67b805e0d..12356b4c7e 100644 --- a/app/react/Library/components/specs/FiltersFromProperties.spec.js +++ b/app/react/Library/components/specs/FiltersFromProperties.spec.js @@ -12,8 +12,8 @@ import SelectFilter from '../SelectFilter'; import TextFilter from '../TextFilter'; import { defaultProperties } from './fixtures/FiltersFromPropertiesFixtures'; -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useLocation: () => jest.fn(), })); jest.mock('app/I18N', () => ({ diff --git a/app/react/Map/specs/LMap.spec.tsx b/app/react/Map/specs/LMap.spec.tsx index ee2a055cce..4104fd57db 100644 --- a/app/react/Map/specs/LMap.spec.tsx +++ b/app/react/Map/specs/LMap.spec.tsx @@ -12,8 +12,8 @@ jest.mock('app/Map/GoogleMapLayer', () => ({ getGoogleLayer: jest.fn(), })); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useRouteError: () => () => undefined, })); diff --git a/app/react/Markdown/components/MarkdownLink.js b/app/react/Markdown/components/MarkdownLink.js index 1e5518b976..db5077cfda 100644 --- a/app/react/Markdown/components/MarkdownLink.js +++ b/app/react/Markdown/components/MarkdownLink.js @@ -1,4 +1,4 @@ -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { isClient } from 'app/utils'; import PropTypes from 'prop-types'; import React from 'react'; diff --git a/app/react/Markdown/components/PayPalDonateLink.js b/app/react/Markdown/components/PayPalDonateLink.js index 02a730bd7f..2d17679266 100644 --- a/app/react/Markdown/components/PayPalDonateLink.js +++ b/app/react/Markdown/components/PayPalDonateLink.js @@ -1,4 +1,4 @@ -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import PropTypes from 'prop-types'; import React from 'react'; diff --git a/app/react/Markdown/components/SearchBox.js b/app/react/Markdown/components/SearchBox.js index 046658a37e..4bf5ea0942 100644 --- a/app/react/Markdown/components/SearchBox.js +++ b/app/react/Markdown/components/SearchBox.js @@ -1,5 +1,5 @@ import { Form, Field } from 'react-redux-form'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router'; import React from 'react'; import PropTypes from 'prop-types'; import rison from 'rison-node'; diff --git a/app/react/Markdown/components/index.js b/app/react/Markdown/components/index.js index f6d1eb5466..a434d35a37 100644 --- a/app/react/Markdown/components/index.js +++ b/app/react/Markdown/components/index.js @@ -1,6 +1,6 @@ import loadable from '@loadable/component'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { Icon } from 'UI'; import Counter from './Counter'; import ContactForm from './ContactForm'; diff --git a/app/react/Markdown/components/specs/MarkdownLink.spec.js b/app/react/Markdown/components/specs/MarkdownLink.spec.js index db0ac42da4..da5a28b495 100644 --- a/app/react/Markdown/components/specs/MarkdownLink.spec.js +++ b/app/react/Markdown/components/specs/MarkdownLink.spec.js @@ -2,8 +2,8 @@ import React from 'react'; import { shallow } from 'enzyme'; import MarkdownLink from '../MarkdownLink.js'; -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), // eslint-disable-next-line jsx-a11y/anchor-has-content, react/prop-types Link: props => , })); diff --git a/app/react/Markdown/components/specs/PayPalDonateLink.spec.js b/app/react/Markdown/components/specs/PayPalDonateLink.spec.js index e872cf3c32..bd75f78ccb 100644 --- a/app/react/Markdown/components/specs/PayPalDonateLink.spec.js +++ b/app/react/Markdown/components/specs/PayPalDonateLink.spec.js @@ -2,8 +2,8 @@ import React from 'react'; import { shallow } from 'enzyme'; import PayPalDonateLink from '../PayPalDonateLink.js'; -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), // eslint-disable-next-line jsx-a11y/anchor-has-content, react/prop-types Link: props => , })); diff --git a/app/react/Markdown/components/specs/SearchBox.spec.js b/app/react/Markdown/components/specs/SearchBox.spec.js index 4d5fc8a7af..77284d7b11 100644 --- a/app/react/Markdown/components/specs/SearchBox.spec.js +++ b/app/react/Markdown/components/specs/SearchBox.spec.js @@ -8,8 +8,8 @@ import SearchBox from '../SearchBox'; const mockUseNavigate = jest.fn(); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useNavigate: () => mockUseNavigate, })); diff --git a/app/react/ProtectedRoute.tsx b/app/react/ProtectedRoute.tsx index b313c3d0b9..6b9267c0f2 100644 --- a/app/react/ProtectedRoute.tsx +++ b/app/react/ProtectedRoute.tsx @@ -1,5 +1,5 @@ import React, { ReactElement } from 'react'; -import { Navigate, Outlet } from 'react-router-dom'; +import { Navigate, Outlet } from 'react-router'; import { store } from 'app/store'; import { ClientSettings } from 'app/apiResponseTypes'; diff --git a/app/react/Routes.tsx b/app/react/Routes.tsx index fa26bd2bdc..8240e25f09 100644 --- a/app/react/Routes.tsx +++ b/app/react/Routes.tsx @@ -1,6 +1,6 @@ /* eslint-disable max-lines */ import React from 'react'; -import { createRoutesFromElements, Route } from 'react-router-dom'; +import { createRoutesFromElements, Route } from 'react-router'; import { IncomingHttpHeaders } from 'http'; import { App } from 'app/App/App'; import { LibraryCards } from 'app/Library/Library'; diff --git a/app/react/Settings/Settings.js b/app/react/Settings/Settings.js index bd63f1fb2a..a949448cc9 100644 --- a/app/react/Settings/Settings.js +++ b/app/react/Settings/Settings.js @@ -1,6 +1,6 @@ import React from 'react'; import { Helmet } from 'react-helmet'; -import { Outlet } from 'react-router-dom'; +import { Outlet } from 'react-router'; import { withOutlet, withRouter } from 'app/componentWrappers'; import RouteHandler from 'app/App/RouteHandler'; import { actions } from 'app/BasicReducer'; diff --git a/app/react/Settings/components/EntityTypesList.js b/app/react/Settings/components/EntityTypesList.js index a2f22ab80f..5ee215c7f0 100644 --- a/app/react/Settings/components/EntityTypesList.js +++ b/app/react/Settings/components/EntityTypesList.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { withContext } from 'app/componentWrappers'; import { deleteTemplate, diff --git a/app/react/Settings/components/specs/EntityTypesList.spec.js b/app/react/Settings/components/specs/EntityTypesList.spec.js index 6bf69ece91..d00516c397 100644 --- a/app/react/Settings/components/specs/EntityTypesList.spec.js +++ b/app/react/Settings/components/specs/EntityTypesList.spec.js @@ -3,8 +3,8 @@ import { shallow } from 'enzyme'; import Immutable from 'immutable'; import { EntityTypesList } from '../EntityTypesList'; -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), // eslint-disable-next-line jsx-a11y/anchor-has-content, react/prop-types Link: props => , })); diff --git a/app/react/Templates/components/specs/MetadataTemplate.spec.js b/app/react/Templates/components/specs/MetadataTemplate.spec.js index 7a09fcd319..9ce6e6fcb4 100644 --- a/app/react/Templates/components/specs/MetadataTemplate.spec.js +++ b/app/react/Templates/components/specs/MetadataTemplate.spec.js @@ -2,6 +2,7 @@ * @jest-environment jsdom */ import React, { Component } from 'react'; +import { BrowserRouter } from 'react-router'; import { DragDropContext } from 'react-dnd-old'; import { Provider } from 'react-redux'; import { modelReducer, formReducer, Field, Control } from 'react-redux-form'; @@ -11,10 +12,8 @@ import Immutable from 'immutable'; import thunk from 'redux-thunk'; import { shallow } from 'enzyme'; import { TestBackend } from 'react-dnd-test-backend'; - import entitiesApi from 'app/Entities/EntitiesAPI'; import pagesApi from 'app/Pages/PagesAPI'; - import { MetadataTemplate, dropTarget, @@ -22,7 +21,6 @@ import { } from 'app/Templates/components/MetadataTemplate'; import MetadataProperty from 'app/Templates/components/MetadataProperty'; import { dragSource } from 'app/Templates/components/PropertyOption'; -import { BrowserRouter } from 'react-router-dom'; import * as templateActions from '../../actions/templateActions'; function sourceTargetTestContext(Target, Source, actions) { diff --git a/app/react/V2/Components/Analitycs/Matomo.tsx b/app/react/V2/Components/Analitycs/Matomo.tsx index 48cd3a9689..8d755133eb 100644 --- a/app/react/V2/Components/Analitycs/Matomo.tsx +++ b/app/react/V2/Components/Analitycs/Matomo.tsx @@ -1,7 +1,7 @@ /* eslint-disable max-statements */ import { useEffect, useRef } from 'react'; import { useAtomValue } from 'jotai'; -import { useLocation } from 'react-router-dom'; +import { useLocation } from 'react-router'; import { globalMatomoAtom, settingsAtom } from 'V2/atoms'; import { isClient } from 'app/utils'; diff --git a/app/react/V2/Components/Analitycs/specs/Matomo.spec.tsx b/app/react/V2/Components/Analitycs/specs/Matomo.spec.tsx index ff77abe57b..1abfe2de45 100644 --- a/app/react/V2/Components/Analitycs/specs/Matomo.spec.tsx +++ b/app/react/V2/Components/Analitycs/specs/Matomo.spec.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; +import { MemoryRouter } from 'react-router'; import { globalMatomoAtom, settingsAtom } from 'V2/atoms'; import { TestAtomStoreProvider } from 'V2/testing'; import { Matomo } from '../Matomo'; diff --git a/app/react/V2/Components/ErrorHandling/GeneralError.tsx b/app/react/V2/Components/ErrorHandling/GeneralError.tsx index 28009af0f8..0a7d605395 100644 --- a/app/react/V2/Components/ErrorHandling/GeneralError.tsx +++ b/app/react/V2/Components/ErrorHandling/GeneralError.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Helmet } from 'react-helmet'; -import { useParams, useSearchParams } from 'react-router-dom'; +import { useParams, useSearchParams } from 'react-router'; import { has } from 'lodash'; import Footer from 'app/App/Footer'; import { searchParamsFromSearchParams } from 'app/utils/routeHelpers'; diff --git a/app/react/V2/Components/ErrorHandling/RouteErrorBoundary.tsx b/app/react/V2/Components/ErrorHandling/RouteErrorBoundary.tsx index c7b25677a2..ee4165fc1f 100644 --- a/app/react/V2/Components/ErrorHandling/RouteErrorBoundary.tsx +++ b/app/react/V2/Components/ErrorHandling/RouteErrorBoundary.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useRouteError } from 'react-router-dom'; +import { useRouteError } from 'react-router'; import { ErrorFallback } from './ErrorFallback'; interface ErrorBoundaryProps { diff --git a/app/react/V2/Components/ErrorHandling/specs/GeneralError.spec.tsx b/app/react/V2/Components/ErrorHandling/specs/GeneralError.spec.tsx index 7729981fcf..1df90ee549 100644 --- a/app/react/V2/Components/ErrorHandling/specs/GeneralError.spec.tsx +++ b/app/react/V2/Components/ErrorHandling/specs/GeneralError.spec.tsx @@ -22,8 +22,8 @@ const mockUseParams = jest.fn().mockImplementation(() => ({ errorCode, })); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useLocation: () => ({ search: '?q=(requestId:%271234%27)', }), diff --git a/app/react/V2/Components/ErrorHandling/specs/RouteErrorBoundary.spec.tsx b/app/react/V2/Components/ErrorHandling/specs/RouteErrorBoundary.spec.tsx index 045d622746..e724b806ac 100644 --- a/app/react/V2/Components/ErrorHandling/specs/RouteErrorBoundary.spec.tsx +++ b/app/react/V2/Components/ErrorHandling/specs/RouteErrorBoundary.spec.tsx @@ -10,8 +10,8 @@ let error: any = null; const mockUseRouteError = jest.fn().mockImplementation(() => error); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useRouteError: () => mockUseRouteError(), })); diff --git a/app/react/V2/Components/Layouts/specs/SettingsContent.cy.tsx b/app/react/V2/Components/Layouts/specs/SettingsContent.cy.tsx index 40f4b33491..b33784c763 100644 --- a/app/react/V2/Components/Layouts/specs/SettingsContent.cy.tsx +++ b/app/react/V2/Components/Layouts/specs/SettingsContent.cy.tsx @@ -1,6 +1,6 @@ import React from 'react'; import 'cypress-axe'; -import { BrowserRouter } from 'react-router-dom'; +import { BrowserRouter } from 'react-router'; import { Provider } from 'react-redux'; import { mount } from '@cypress/react18'; import { LEGACY_createStore as createStore } from 'V2/testing'; diff --git a/app/react/V2/Components/UI/Paginator.tsx b/app/react/V2/Components/UI/Paginator.tsx index fc988cd970..490ca191d3 100644 --- a/app/react/V2/Components/UI/Paginator.tsx +++ b/app/react/V2/Components/UI/Paginator.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/20/solid'; import { Translate } from 'app/I18N'; diff --git a/app/react/V2/Components/UI/Sidepanel.tsx b/app/react/V2/Components/UI/Sidepanel.tsx index 8c997388d8..70e6bee133 100644 --- a/app/react/V2/Components/UI/Sidepanel.tsx +++ b/app/react/V2/Components/UI/Sidepanel.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/no-multi-comp */ import React from 'react'; import { Transition } from '@headlessui/react'; -import { useParams } from 'react-router-dom'; +import { useParams } from 'react-router'; import { XMarkIcon } from '@heroicons/react/20/solid'; import { availableLanguages } from 'shared/language'; import { Translate } from 'app/I18N'; diff --git a/app/react/V2/Routes/Settings/Account/Account.tsx b/app/react/V2/Routes/Settings/Account/Account.tsx index f036e0d266..7b93bead71 100644 --- a/app/react/V2/Routes/Settings/Account/Account.tsx +++ b/app/react/V2/Routes/Settings/Account/Account.tsx @@ -2,7 +2,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React, { useRef, useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router-dom'; +import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router'; import { useForm } from 'react-hook-form'; import { useSetAtom } from 'jotai'; import { ClientUserSchema } from 'app/apiResponseTypes'; diff --git a/app/react/V2/Routes/Settings/Account/Components/TwoFactorSetup.tsx b/app/react/V2/Routes/Settings/Account/Components/TwoFactorSetup.tsx index f4243421fb..18135674d4 100644 --- a/app/react/V2/Routes/Settings/Account/Components/TwoFactorSetup.tsx +++ b/app/react/V2/Routes/Settings/Account/Components/TwoFactorSetup.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import api from 'app/utils/api'; -import { useRevalidator } from 'react-router-dom'; +import { useRevalidator } from 'react-router'; import { useSetAtom } from 'jotai'; import { RequestParams } from 'app/utils/RequestParams'; diff --git a/app/react/V2/Routes/Settings/ActivityLog/ActivityLog.tsx b/app/react/V2/Routes/Settings/ActivityLog/ActivityLog.tsx index e8c5f43174..9b3e1bbaa7 100644 --- a/app/react/V2/Routes/Settings/ActivityLog/ActivityLog.tsx +++ b/app/react/V2/Routes/Settings/ActivityLog/ActivityLog.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/jsx-props-no-spreading */ import React, { useEffect, useState } from 'react'; -import { useLoaderData, useLocation, useSearchParams } from 'react-router-dom'; +import { useLoaderData, useLocation, useSearchParams } from 'react-router'; import { Row, SortingState } from '@tanstack/react-table'; import { FunnelIcon } from '@heroicons/react/24/outline'; import { useAtomValue } from 'jotai'; diff --git a/app/react/V2/Routes/Settings/ActivityLog/ActivityLogLoader.ts b/app/react/V2/Routes/Settings/ActivityLog/ActivityLogLoader.ts index 160fd9af6f..8738a1d04c 100644 --- a/app/react/V2/Routes/Settings/ActivityLog/ActivityLogLoader.ts +++ b/app/react/V2/Routes/Settings/ActivityLog/ActivityLogLoader.ts @@ -1,5 +1,5 @@ /* eslint-disable react/jsx-props-no-spreading */ -import { LoaderFunction, SetURLSearchParams, createSearchParams, Location } from 'react-router-dom'; +import { LoaderFunction, SetURLSearchParams, createSearchParams, Location } from 'react-router'; import { IncomingHttpHeaders } from 'http'; import _, { isArray, isEqual, isObject } from 'lodash'; import moment from 'moment'; diff --git a/app/react/V2/Routes/Settings/Collection/Collection.tsx b/app/react/V2/Routes/Settings/Collection/Collection.tsx index 059b3f4559..112309876e 100644 --- a/app/react/V2/Routes/Settings/Collection/Collection.tsx +++ b/app/react/V2/Routes/Settings/Collection/Collection.tsx @@ -4,7 +4,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router-dom'; +import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router'; import { useForm } from 'react-hook-form'; import { useSetAtom } from 'jotai'; import { isUndefined } from 'lodash'; diff --git a/app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx b/app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx index 51382e40c3..ad78aead3e 100644 --- a/app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx +++ b/app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx @@ -2,7 +2,7 @@ /* eslint-disable no-spaced-func */ /* eslint-disable max-statements */ import React, { useEffect, useState } from 'react'; -import { LoaderFunction, useBlocker, useLoaderData, useRevalidator } from 'react-router-dom'; +import { LoaderFunction, useBlocker, useLoaderData, useRevalidator } from 'react-router'; import { IncomingHttpHeaders } from 'http'; import { useSetAtom } from 'jotai'; import { Translate } from 'app/I18N'; diff --git a/app/react/V2/Routes/Settings/CustomUploads/components/DropzoneModal.tsx b/app/react/V2/Routes/Settings/CustomUploads/components/DropzoneModal.tsx index 258665d1f2..f92f2ea73e 100644 --- a/app/react/V2/Routes/Settings/CustomUploads/components/DropzoneModal.tsx +++ b/app/react/V2/Routes/Settings/CustomUploads/components/DropzoneModal.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { useRevalidator } from 'react-router-dom'; +import { useRevalidator } from 'react-router'; import { useSetAtom } from 'jotai'; import { FetchResponseError } from 'shared/JSONRequest'; import { Translate } from 'app/I18N'; diff --git a/app/react/V2/Routes/Settings/CustomUploads/components/EditFileSidepanel.tsx b/app/react/V2/Routes/Settings/CustomUploads/components/EditFileSidepanel.tsx index 261ee75166..bfc19b2678 100644 --- a/app/react/V2/Routes/Settings/CustomUploads/components/EditFileSidepanel.tsx +++ b/app/react/V2/Routes/Settings/CustomUploads/components/EditFileSidepanel.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React from 'react'; import { useForm } from 'react-hook-form'; -import { useRevalidator } from 'react-router-dom'; +import { useRevalidator } from 'react-router'; import { useSetAtom } from 'jotai'; import { FileType } from 'shared/types/fileType'; import { Translate } from 'app/I18N'; diff --git a/app/react/V2/Routes/Settings/Customization/Customization.tsx b/app/react/V2/Routes/Settings/Customization/Customization.tsx index 7d816ca927..2b17e49424 100644 --- a/app/react/V2/Routes/Settings/Customization/Customization.tsx +++ b/app/react/V2/Routes/Settings/Customization/Customization.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { LoaderFunction, useBlocker, useLoaderData } from 'react-router-dom'; +import { LoaderFunction, useBlocker, useLoaderData } from 'react-router'; import { IncomingHttpHeaders } from 'http'; import { useSetAtom } from 'jotai'; import { FetchResponseError } from 'shared/JSONRequest'; diff --git a/app/react/V2/Routes/Settings/Dashboard/Dashboard.tsx b/app/react/V2/Routes/Settings/Dashboard/Dashboard.tsx index 3115dd7f92..a150db2c52 100644 --- a/app/react/V2/Routes/Settings/Dashboard/Dashboard.tsx +++ b/app/react/V2/Routes/Settings/Dashboard/Dashboard.tsx @@ -2,7 +2,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData } from 'react-router-dom'; +import { LoaderFunction, useLoaderData } from 'react-router'; import { Translate } from 'app/I18N'; import { SettingsContent } from 'app/V2/Components/Layouts/SettingsContent'; diff --git a/app/react/V2/Routes/Settings/Filters/FiltersTable.tsx b/app/react/V2/Routes/Settings/Filters/FiltersTable.tsx index 59d55131ca..fdb75c9eb2 100644 --- a/app/react/V2/Routes/Settings/Filters/FiltersTable.tsx +++ b/app/react/V2/Routes/Settings/Filters/FiltersTable.tsx @@ -1,6 +1,6 @@ /* eslint-disable max-statements */ import React, { useEffect, useMemo, useRef, useState } from 'react'; -import { LoaderFunction, useBlocker, useLoaderData, useRevalidator } from 'react-router-dom'; +import { LoaderFunction, useBlocker, useLoaderData, useRevalidator } from 'react-router'; import { useSetAtom } from 'jotai'; import { IncomingHttpHeaders } from 'http'; import { RowSelectionState } from '@tanstack/react-table'; diff --git a/app/react/V2/Routes/Settings/Filters/components/FiltersSidepanel.tsx b/app/react/V2/Routes/Settings/Filters/components/FiltersSidepanel.tsx index 3421cd5aef..f6a6f4339d 100644 --- a/app/react/V2/Routes/Settings/Filters/components/FiltersSidepanel.tsx +++ b/app/react/V2/Routes/Settings/Filters/components/FiltersSidepanel.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { useForm, Controller } from 'react-hook-form'; import { useAtomValue } from 'jotai'; -import { useLoaderData } from 'react-router-dom'; +import { useLoaderData } from 'react-router'; import uniqueID from 'shared/uniqueID'; import { Translate } from 'app/I18N'; import { ClientTemplateSchema } from 'app/istore'; diff --git a/app/react/V2/Routes/Settings/IX/IXDashboard.tsx b/app/react/V2/Routes/Settings/IX/IXDashboard.tsx index 214dce49ae..d8a49eebc4 100644 --- a/app/react/V2/Routes/Settings/IX/IXDashboard.tsx +++ b/app/react/V2/Routes/Settings/IX/IXDashboard.tsx @@ -1,7 +1,7 @@ /* eslint-disable max-statements */ import React, { useMemo, useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router-dom'; +import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router'; import { useSetAtom } from 'jotai'; import * as extractorsAPI from 'app/V2/api/ix/extractors'; import * as templatesAPI from 'V2/api/templates'; diff --git a/app/react/V2/Routes/Settings/IX/IXSuggestions.tsx b/app/react/V2/Routes/Settings/IX/IXSuggestions.tsx index e71a3c7ec6..8b3acd3c44 100644 --- a/app/react/V2/Routes/Settings/IX/IXSuggestions.tsx +++ b/app/react/V2/Routes/Settings/IX/IXSuggestions.tsx @@ -9,7 +9,7 @@ import { useNavigate, useRevalidator, useSearchParams, -} from 'react-router-dom'; +} from 'react-router'; import { SortingState } from '@tanstack/react-table'; import { useSetAtom } from 'jotai'; import * as extractorsAPI from 'app/V2/api/ix/extractors'; diff --git a/app/react/V2/Routes/Settings/IX/components/FiltersSidepanel.tsx b/app/react/V2/Routes/Settings/IX/components/FiltersSidepanel.tsx index 8f96df6399..3d20ab8224 100644 --- a/app/react/V2/Routes/Settings/IX/components/FiltersSidepanel.tsx +++ b/app/react/V2/Routes/Settings/IX/components/FiltersSidepanel.tsx @@ -6,7 +6,7 @@ import { Translate } from 'app/I18N'; import { Button, Card, Sidepanel } from 'V2/Components/UI'; import { Checkbox } from 'app/V2/Components/Forms'; import { useForm } from 'react-hook-form'; -import { useSearchParams } from 'react-router-dom'; +import { useSearchParams } from 'react-router'; interface FiltersSidepanelProps { showSidepanel: boolean; diff --git a/app/react/V2/Routes/Settings/IX/components/SuggestedValue.tsx b/app/react/V2/Routes/Settings/IX/components/SuggestedValue.tsx index 25dbee9c36..7a044f3a63 100644 --- a/app/react/V2/Routes/Settings/IX/components/SuggestedValue.tsx +++ b/app/react/V2/Routes/Settings/IX/components/SuggestedValue.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { useParams } from 'react-router-dom'; +import { useParams } from 'react-router'; import { usePopper } from 'react-popper'; import { useAtomValue } from 'jotai'; import { Popover } from '@headlessui/react'; diff --git a/app/react/V2/Routes/Settings/IX/components/TableElements.tsx b/app/react/V2/Routes/Settings/IX/components/TableElements.tsx index ff249a3d71..63e46fc655 100644 --- a/app/react/V2/Routes/Settings/IX/components/TableElements.tsx +++ b/app/react/V2/Routes/Settings/IX/components/TableElements.tsx @@ -2,7 +2,7 @@ /* eslint-disable react/no-multi-comp */ import React from 'react'; import { Cell, CellContext, Row, createColumnHelper } from '@tanstack/react-table'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { CheckCircleIcon } from '@heroicons/react/24/outline'; import { Translate } from 'app/I18N'; import { Button, Pill } from 'V2/Components/UI'; diff --git a/app/react/V2/Routes/Settings/Languages/LanguagesList.tsx b/app/react/V2/Routes/Settings/Languages/LanguagesList.tsx index d122a99742..96025c7027 100644 --- a/app/react/V2/Routes/Settings/Languages/LanguagesList.tsx +++ b/app/react/V2/Routes/Settings/Languages/LanguagesList.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React, { useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { useLoaderData, LoaderFunction } from 'react-router-dom'; +import { useLoaderData, LoaderFunction } from 'react-router'; import { useAtomValue } from 'jotai'; import { intersectionBy, keyBy, merge, values } from 'lodash'; import { Row, createColumnHelper } from '@tanstack/react-table'; diff --git a/app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx b/app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx index b6412639ad..92dde189db 100644 --- a/app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx +++ b/app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx @@ -2,7 +2,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React, { useState, useRef, useEffect } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData, useRevalidator, useBlocker } from 'react-router-dom'; +import { LoaderFunction, useLoaderData, useRevalidator, useBlocker } from 'react-router'; import { Row, RowSelectionState } from '@tanstack/react-table'; import { useSetAtom } from 'jotai'; import { cloneDeep, isEqual } from 'lodash'; diff --git a/app/react/V2/Routes/Settings/Pages/PageEditor.tsx b/app/react/V2/Routes/Settings/Pages/PageEditor.tsx index 0c96a21739..b8f0726a46 100644 --- a/app/react/V2/Routes/Settings/Pages/PageEditor.tsx +++ b/app/react/V2/Routes/Settings/Pages/PageEditor.tsx @@ -10,7 +10,7 @@ import { useLoaderData, useNavigate, useRevalidator, -} from 'react-router-dom'; +} from 'react-router'; import { useForm } from 'react-hook-form'; import { useSetAtom } from 'jotai'; import { debounce } from 'lodash'; diff --git a/app/react/V2/Routes/Settings/Pages/PagesList.tsx b/app/react/V2/Routes/Settings/Pages/PagesList.tsx index 860927c1d1..4b5f67fc7a 100644 --- a/app/react/V2/Routes/Settings/Pages/PagesList.tsx +++ b/app/react/V2/Routes/Settings/Pages/PagesList.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/no-multi-comp */ import React, { useState } from 'react'; -import { Link, LoaderFunction, useLoaderData, useRevalidator } from 'react-router-dom'; +import { Link, LoaderFunction, useLoaderData, useRevalidator } from 'react-router'; import { createColumnHelper } from '@tanstack/react-table'; import { IncomingHttpHeaders } from 'http'; import { useSetAtom } from 'jotai'; diff --git a/app/react/V2/Routes/Settings/Pages/components/PageEditorComponents.tsx b/app/react/V2/Routes/Settings/Pages/components/PageEditorComponents.tsx index 660ec9b3f7..1857df2957 100644 --- a/app/react/V2/Routes/Settings/Pages/components/PageEditorComponents.tsx +++ b/app/react/V2/Routes/Settings/Pages/components/PageEditorComponents.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/no-multi-comp */ import React from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { InformationCircleIcon, ExclamationTriangleIcon } from '@heroicons/react/20/solid'; import { Translate } from 'app/I18N'; diff --git a/app/react/V2/Routes/Settings/Pages/components/PageListTable.tsx b/app/react/V2/Routes/Settings/Pages/components/PageListTable.tsx index c18637a126..9193597d2b 100644 --- a/app/react/V2/Routes/Settings/Pages/components/PageListTable.tsx +++ b/app/react/V2/Routes/Settings/Pages/components/PageListTable.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/no-multi-comp */ import React from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { kebabCase } from 'lodash'; import { CellContext } from '@tanstack/react-table'; import { Button, Pill } from 'app/V2/Components/UI'; diff --git a/app/react/V2/Routes/Settings/ParagraphExtraction/PXEntities.tsx b/app/react/V2/Routes/Settings/ParagraphExtraction/PXEntities.tsx index e6104a2522..33e56c89f4 100644 --- a/app/react/V2/Routes/Settings/ParagraphExtraction/PXEntities.tsx +++ b/app/react/V2/Routes/Settings/ParagraphExtraction/PXEntities.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useMemo, useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData } from 'react-router-dom'; +import { LoaderFunction, useLoaderData } from 'react-router'; import * as pxEntitiesApi from 'app/V2/api/paragraphExtractor/entities'; import { SettingsContent } from 'V2/Components/Layouts/SettingsContent'; import { Table } from 'V2/Components/UI'; diff --git a/app/react/V2/Routes/Settings/ParagraphExtraction/PXParagraphs.tsx b/app/react/V2/Routes/Settings/ParagraphExtraction/PXParagraphs.tsx index 7845d66c3e..4c8a61293e 100644 --- a/app/react/V2/Routes/Settings/ParagraphExtraction/PXParagraphs.tsx +++ b/app/react/V2/Routes/Settings/ParagraphExtraction/PXParagraphs.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useMemo, useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData } from 'react-router-dom'; +import { LoaderFunction, useLoaderData } from 'react-router'; import * as pxParagraphApi from 'app/V2/api/paragraphExtractor/paragraphs'; import { SettingsContent } from 'V2/Components/Layouts/SettingsContent'; import { Table, Button } from 'V2/Components/UI'; diff --git a/app/react/V2/Routes/Settings/ParagraphExtraction/ParagraphExtraction.tsx b/app/react/V2/Routes/Settings/ParagraphExtraction/ParagraphExtraction.tsx index ce73466cb3..10ab988f92 100644 --- a/app/react/V2/Routes/Settings/ParagraphExtraction/ParagraphExtraction.tsx +++ b/app/react/V2/Routes/Settings/ParagraphExtraction/ParagraphExtraction.tsx @@ -1,7 +1,7 @@ /* eslint-disable max-statements */ import React, { useMemo, useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router-dom'; +import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router'; import * as extractorsAPI from 'app/V2/api/paragraphExtractor/extractors'; import { SettingsContent } from 'V2/Components/Layouts/SettingsContent'; import { Button, Table, ConfirmationModal } from 'V2/Components/UI'; diff --git a/app/react/V2/Routes/Settings/ParagraphExtraction/components/ExtractorModal.tsx b/app/react/V2/Routes/Settings/ParagraphExtraction/components/ExtractorModal.tsx index 05221b45c7..a5e49012c7 100644 --- a/app/react/V2/Routes/Settings/ParagraphExtraction/components/ExtractorModal.tsx +++ b/app/react/V2/Routes/Settings/ParagraphExtraction/components/ExtractorModal.tsx @@ -8,7 +8,7 @@ import { Translate } from 'app/I18N'; import { Template } from 'app/apiResponseTypes'; import { ParagraphExtractorApiPayload } from '../types'; import { NoQualifiedTemplatesMessage } from './NoQualifiedTemplate'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; interface ExtractorModalProps { setShowModal: React.Dispatch>; diff --git a/app/react/V2/Routes/Settings/ParagraphExtraction/components/PXEntityTableElements.tsx b/app/react/V2/Routes/Settings/ParagraphExtraction/components/PXEntityTableElements.tsx index f3ab7a235d..080cc70351 100644 --- a/app/react/V2/Routes/Settings/ParagraphExtraction/components/PXEntityTableElements.tsx +++ b/app/react/V2/Routes/Settings/ParagraphExtraction/components/PXEntityTableElements.tsx @@ -2,7 +2,7 @@ /* eslint-disable react/no-multi-comp */ import React from 'react'; import { CellContext, createColumnHelper } from '@tanstack/react-table'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { Translate } from 'app/I18N'; import { Button, Pill } from 'V2/Components/UI'; import { PXEntityTable } from '../types'; diff --git a/app/react/V2/Routes/Settings/ParagraphExtraction/components/PXTableElements.tsx b/app/react/V2/Routes/Settings/ParagraphExtraction/components/PXTableElements.tsx index 34f1907aeb..2a3635cc05 100644 --- a/app/react/V2/Routes/Settings/ParagraphExtraction/components/PXTableElements.tsx +++ b/app/react/V2/Routes/Settings/ParagraphExtraction/components/PXTableElements.tsx @@ -2,7 +2,7 @@ /* eslint-disable react/no-multi-comp */ import React from 'react'; import { CellContext, createColumnHelper } from '@tanstack/react-table'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { Translate } from 'app/I18N'; import { Button, Pill } from 'V2/Components/UI'; import { PXTable } from '../types'; diff --git a/app/react/V2/Routes/Settings/ParagraphExtraction/components/ViewParagraph.tsx b/app/react/V2/Routes/Settings/ParagraphExtraction/components/ViewParagraph.tsx index b76a9d50d5..8bcedb4b4b 100644 --- a/app/react/V2/Routes/Settings/ParagraphExtraction/components/ViewParagraph.tsx +++ b/app/react/V2/Routes/Settings/ParagraphExtraction/components/ViewParagraph.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { Translate } from 'app/I18N'; import { PXParagraphTable } from '../types'; import { DisplayPills } from './DisplayPills'; diff --git a/app/react/V2/Routes/Settings/RelationshipTypes/RelationshipTypes.tsx b/app/react/V2/Routes/Settings/RelationshipTypes/RelationshipTypes.tsx index 284edc3479..e00d5f00e7 100644 --- a/app/react/V2/Routes/Settings/RelationshipTypes/RelationshipTypes.tsx +++ b/app/react/V2/Routes/Settings/RelationshipTypes/RelationshipTypes.tsx @@ -2,7 +2,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React, { useEffect, useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router-dom'; +import { LoaderFunction, useLoaderData, useRevalidator } from 'react-router'; import { Row } from '@tanstack/react-table'; import { useSetAtom, useAtomValue } from 'jotai'; import { Translate } from 'app/I18N'; diff --git a/app/react/V2/Routes/Settings/Thesauri/EditThesaurus.tsx b/app/react/V2/Routes/Settings/Thesauri/EditThesaurus.tsx index f4bc769f75..42ba24df11 100644 --- a/app/react/V2/Routes/Settings/Thesauri/EditThesaurus.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/EditThesaurus.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/jsx-props-no-spreading */ import React, { useCallback, useMemo, useState } from 'react'; -import { Location, useBlocker, useLoaderData, useNavigate } from 'react-router-dom'; +import { Location, useBlocker, useLoaderData, useNavigate } from 'react-router'; import { useForm } from 'react-hook-form'; import { useAtomValue, useSetAtom } from 'jotai'; import { Row } from '@tanstack/react-table'; diff --git a/app/react/V2/Routes/Settings/Thesauri/ThesauriList.tsx b/app/react/V2/Routes/Settings/Thesauri/ThesauriList.tsx index 777def9121..1b1f11caf7 100644 --- a/app/react/V2/Routes/Settings/Thesauri/ThesauriList.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/ThesauriList.tsx @@ -1,6 +1,6 @@ import React, { useMemo, useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { Link, LoaderFunction, useLoaderData, useRevalidator } from 'react-router-dom'; +import { Link, LoaderFunction, useLoaderData, useRevalidator } from 'react-router'; import { useSetAtom, useAtomValue } from 'jotai'; import { Translate } from 'app/I18N'; import ThesauriAPI from 'app/V2/api/thesauri'; diff --git a/app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx b/app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx index 6ebf60c14c..93831f4285 100644 --- a/app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/jsx-props-no-spreading */ import React from 'react'; -import { useNavigate, useRevalidator } from 'react-router-dom'; +import { useNavigate, useRevalidator } from 'react-router'; import { SubmitHandler, UseFormReturn } from 'react-hook-form'; import { useAtom, useSetAtom } from 'jotai'; import { isEqual, remove } from 'lodash'; diff --git a/app/react/V2/Routes/Settings/Thesauri/components/ThesauriTable.tsx b/app/react/V2/Routes/Settings/Thesauri/components/ThesauriTable.tsx index 6a2323f802..bcb1677042 100644 --- a/app/react/V2/Routes/Settings/Thesauri/components/ThesauriTable.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/components/ThesauriTable.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router'; import { Row } from '@tanstack/react-table'; import { Translate } from 'app/I18N'; import { Table } from 'app/V2/Components/UI'; diff --git a/app/react/V2/Routes/Settings/Thesauri/components/ThesaurusActions.tsx b/app/react/V2/Routes/Settings/Thesauri/components/ThesaurusActions.tsx index 352c618f3e..f18a032245 100644 --- a/app/react/V2/Routes/Settings/Thesauri/components/ThesaurusActions.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/components/ThesaurusActions.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/no-multi-comp */ import React, { Dispatch, SetStateAction } from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { Translate } from 'app/I18N'; import { Button, ConfirmationModal } from 'app/V2/Components/UI'; import { ConfirmationCallback } from '../helpers'; diff --git a/app/react/V2/Routes/Settings/Thesauri/helpers.ts b/app/react/V2/Routes/Settings/Thesauri/helpers.ts index 0b62859fa3..a005f5fdf6 100644 --- a/app/react/V2/Routes/Settings/Thesauri/helpers.ts +++ b/app/react/V2/Routes/Settings/Thesauri/helpers.ts @@ -1,5 +1,5 @@ import { SetStateAction } from 'react'; -import { LoaderFunction } from 'react-router-dom'; +import { LoaderFunction } from 'react-router'; import { IncomingHttpHeaders } from 'http'; import { Row, RowSelectionState } from '@tanstack/react-table'; import { assign, isEqual, orderBy, remove } from 'lodash'; diff --git a/app/react/V2/Routes/Settings/Thesauri/specs/Thesauri.spec.tsx b/app/react/V2/Routes/Settings/Thesauri/specs/Thesauri.spec.tsx index e698e641b3..70ff458de9 100644 --- a/app/react/V2/Routes/Settings/Thesauri/specs/Thesauri.spec.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/specs/Thesauri.spec.tsx @@ -13,7 +13,7 @@ import { render, cleanup, } from '@testing-library/react/pure'; -import { createMemoryRouter, RouterProvider } from 'react-router-dom'; +import { createMemoryRouter, RouterProvider } from 'react-router'; import { Provider } from 'react-redux'; import { has } from 'lodash'; import { fromJS } from 'immutable'; diff --git a/app/react/V2/Routes/Settings/Translations/EditTranslations.tsx b/app/react/V2/Routes/Settings/Translations/EditTranslations.tsx index 69dc388a81..85865dfab0 100644 --- a/app/react/V2/Routes/Settings/Translations/EditTranslations.tsx +++ b/app/react/V2/Routes/Settings/Translations/EditTranslations.tsx @@ -9,7 +9,7 @@ import { Link, ActionFunction, useFetcher, -} from 'react-router-dom'; +} from 'react-router'; import { InformationCircleIcon } from '@heroicons/react/20/solid'; import { IncomingHttpHeaders } from 'http'; import { useForm } from 'react-hook-form'; diff --git a/app/react/V2/Routes/Settings/Translations/TranslationsList.tsx b/app/react/V2/Routes/Settings/Translations/TranslationsList.tsx index c4a450c4d5..d3f477a85a 100644 --- a/app/react/V2/Routes/Settings/Translations/TranslationsList.tsx +++ b/app/react/V2/Routes/Settings/Translations/TranslationsList.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { IncomingHttpHeaders } from 'http'; -import { useLoaderData, LoaderFunction } from 'react-router-dom'; +import { useLoaderData, LoaderFunction } from 'react-router'; import { createColumnHelper } from '@tanstack/react-table'; import { Translate } from 'app/I18N'; import { ClientTranslationContextSchema, ClientTranslationSchema } from 'app/istore'; diff --git a/app/react/V2/Routes/Settings/Translations/components/TableComponents.tsx b/app/react/V2/Routes/Settings/Translations/components/TableComponents.tsx index 3d12001da0..afc18e1f17 100644 --- a/app/react/V2/Routes/Settings/Translations/components/TableComponents.tsx +++ b/app/react/V2/Routes/Settings/Translations/components/TableComponents.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/no-multi-comp */ import React from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from 'react-router'; import { CellContext } from '@tanstack/react-table'; import { Translate } from 'app/I18N'; import { Button, Pill } from 'V2/Components/UI'; diff --git a/app/react/V2/Routes/Settings/Users/Users.tsx b/app/react/V2/Routes/Settings/Users/Users.tsx index 52a73c3099..4029732d14 100644 --- a/app/react/V2/Routes/Settings/Users/Users.tsx +++ b/app/react/V2/Routes/Settings/Users/Users.tsx @@ -1,7 +1,7 @@ /* eslint-disable max-lines */ import React, { useRef, useState } from 'react'; import { IncomingHttpHeaders } from 'http'; -import { ActionFunction, LoaderFunction, useFetcher, useLoaderData } from 'react-router-dom'; +import { ActionFunction, LoaderFunction, useFetcher, useLoaderData } from 'react-router'; import { Translate } from 'app/I18N'; import { Button, ConfirmationModal, Table, Tabs } from 'V2/Components/UI'; import * as usersAPI from 'V2/api/users'; diff --git a/app/react/V2/Routes/Settings/Users/components/GroupFormSidepanel.tsx b/app/react/V2/Routes/Settings/Users/components/GroupFormSidepanel.tsx index faa6286c12..492747ca68 100644 --- a/app/react/V2/Routes/Settings/Users/components/GroupFormSidepanel.tsx +++ b/app/react/V2/Routes/Settings/Users/components/GroupFormSidepanel.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React from 'react'; import { useForm } from 'react-hook-form'; -import { useFetcher } from 'react-router-dom'; +import { useFetcher } from 'react-router'; import { Translate } from 'app/I18N'; import { Button, Card, Sidepanel } from 'V2/Components/UI'; import { InputField, MultiSelect } from 'V2/Components/Forms'; diff --git a/app/react/V2/Routes/Settings/Users/components/UserFormSidepanel.tsx b/app/react/V2/Routes/Settings/Users/components/UserFormSidepanel.tsx index acd63c9e65..daf4e97066 100644 --- a/app/react/V2/Routes/Settings/Users/components/UserFormSidepanel.tsx +++ b/app/react/V2/Routes/Settings/Users/components/UserFormSidepanel.tsx @@ -3,7 +3,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import React, { useEffect, useRef, useState } from 'react'; import { useForm } from 'react-hook-form'; -import { useFetcher } from 'react-router-dom'; +import { useFetcher } from 'react-router'; import { FetchResponseError } from 'shared/JSONRequest'; import { t, Translate } from 'app/I18N'; import { InputField, Select, MultiSelect } from 'V2/Components/Forms'; diff --git a/app/react/V2/Routes/Settings/Users/useHandleNotifications.tsx b/app/react/V2/Routes/Settings/Users/useHandleNotifications.tsx index 327aaa467b..2fc97e396e 100644 --- a/app/react/V2/Routes/Settings/Users/useHandleNotifications.tsx +++ b/app/react/V2/Routes/Settings/Users/useHandleNotifications.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { useFetchers } from 'react-router-dom'; +import { useFetchers } from 'react-router'; import { useSetAtom } from 'jotai'; import { last } from 'lodash'; import { Translate } from 'app/I18N'; diff --git a/app/react/V2/api/translations/index.ts b/app/react/V2/api/translations/index.ts index 66a2c9026e..035f87cf9c 100644 --- a/app/react/V2/api/translations/index.ts +++ b/app/react/V2/api/translations/index.ts @@ -1,4 +1,4 @@ -import { Params } from 'react-router-dom'; +import { Params } from 'react-router'; import { IncomingHttpHeaders } from 'http'; import { I18NApi } from 'app/I18N'; import { ClientTranslationSchema } from 'app/istore'; diff --git a/app/react/Viewer/components/Paginator.js b/app/react/Viewer/components/Paginator.js index f98a73f3a7..abb19055c2 100644 --- a/app/react/Viewer/components/Paginator.js +++ b/app/react/Viewer/components/Paginator.js @@ -1,7 +1,7 @@ /* eslint-disable react/jsx-props-no-spreading */ import PropTypes from 'prop-types'; import React from 'react'; -import { useSearchParams } from 'react-router-dom'; +import { useSearchParams } from 'react-router'; import { Translate } from 'app/I18N'; import { CurrentLocationLink } from 'app/Layout'; import { searchParamsFromSearchParams } from 'app/utils/routeHelpers'; diff --git a/app/react/Viewer/components/specs/Paginator.spec.js b/app/react/Viewer/components/specs/Paginator.spec.js index 15ee01a937..86c2593b71 100644 --- a/app/react/Viewer/components/specs/Paginator.spec.js +++ b/app/react/Viewer/components/specs/Paginator.spec.js @@ -17,8 +17,8 @@ const mockUseSearchParams = jest.fn().mockImplementation(() => { return [params]; }); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useSearchParams: () => mockUseSearchParams(), useLocation: () => mockUseLocation(), // eslint-disable-next-line jsx-a11y/anchor-has-content, react/prop-types diff --git a/app/react/Viewer/specs/PDFView.spec.js b/app/react/Viewer/specs/PDFView.spec.js index 32ae116b5d..893dee9916 100644 --- a/app/react/Viewer/specs/PDFView.spec.js +++ b/app/react/Viewer/specs/PDFView.spec.js @@ -48,8 +48,8 @@ const mockUseSearchParams = jest.fn().mockImplementation(() => { return [params]; }); const mockNavigate = jest.fn().mockImplementation(path => path); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), useSearchParams: () => mockUseSearchParams(), useLocation: () => mockUseLocation(), useNavigate: () => path => mockNavigate(path), diff --git a/app/react/componentWrappers.tsx b/app/react/componentWrappers.tsx index 04b3607ffe..5660171136 100644 --- a/app/react/componentWrappers.tsx +++ b/app/react/componentWrappers.tsx @@ -8,7 +8,7 @@ import { useOutlet, useParams, useSearchParams, -} from 'react-router-dom'; +} from 'react-router'; import { AppMainContext } from './App/AppMainContext'; import { searchParamsFromSearchParams } from './utils/routeHelpers'; diff --git a/app/react/entry-client.tsx b/app/react/entry-client.tsx index bedeb6d758..22407899fd 100644 --- a/app/react/entry-client.tsx +++ b/app/react/entry-client.tsx @@ -8,7 +8,7 @@ import { matchRoutes, useLocation, useNavigationType, -} from 'react-router-dom'; +} from 'react-router'; import { Provider } from 'jotai'; import { Provider as ReduxProvider } from 'react-redux'; import type { RequestError } from 'V2/shared/errorUtils'; diff --git a/app/react/entry-server.tsx b/app/react/entry-server.tsx index 4780605e83..3b7442dc58 100644 --- a/app/react/entry-server.tsx +++ b/app/react/entry-server.tsx @@ -3,8 +3,13 @@ import { Request as ExpressRequest, Response } from 'express'; // eslint-disable-next-line node/no-restricted-import import fs from 'fs'; -import { AgnosticDataRouteObject, createStaticHandler } from '@remix-run/router'; -import { matchRoutes, RouteObject } from 'react-router-dom'; +import { + createStaticHandler, + createStaticRouter, + matchRoutes, + RouteObject, + StaticRouterProvider, +} from 'react-router'; import React from 'react'; import ReactDOMServer from 'react-dom/server'; import { Helmet } from 'react-helmet'; @@ -13,7 +18,6 @@ import { omit, isEmpty } from 'lodash'; import { Provider as ReduxProvider } from 'react-redux'; import api from 'app/utils/api'; import { RequestParams } from 'app/utils/RequestParams'; -import { createStaticRouter, StaticRouterProvider } from 'react-router-dom/server'; import { FetchResponseError } from 'shared/JSONRequest'; import { ClientSettings } from 'app/apiResponseTypes'; import translationsApi, { IndexedTranslations } from '../api/i18n/translations'; @@ -253,7 +257,7 @@ const getSSRProperties = async ( language?: string ) => { const { reduxStore, atomStoreData } = await prepareStores(req, settings, language); - const { query } = createStaticHandler(routes as AgnosticDataRouteObject[]); + const { query } = createStaticHandler(routes); const { fetchRequest, ssrError } = createFetchRequest(req); const staticHandleContext = await query(fetchRequest); const router = createStaticRouter(routes, staticHandleContext as any); diff --git a/app/react/getIndexElement.tsx b/app/react/getIndexElement.tsx index 7b7c481810..125a0d52a8 100644 --- a/app/react/getIndexElement.tsx +++ b/app/react/getIndexElement.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Navigate } from 'react-router-dom'; +import { Navigate } from 'react-router'; import { ClientSettings } from 'app/apiResponseTypes'; import { validateHomePageRoute } from './utils/routeHelpers'; import { PageView } from './Pages/PageView'; diff --git a/app/react/stories/Paginator.stories.tsx b/app/react/stories/Paginator.stories.tsx index 9664ce3461..8e34d60a4a 100644 --- a/app/react/stories/Paginator.stories.tsx +++ b/app/react/stories/Paginator.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { MemoryRouter } from 'react-router-dom'; +import { MemoryRouter } from 'react-router'; import { Provider } from 'react-redux'; import type { Meta, StoryObj } from '@storybook/react'; import { Paginator } from 'app/V2/Components/UI'; diff --git a/app/react/utils/api.js b/app/react/utils/api.js index 4e5776d68c..1ec002174e 100644 --- a/app/react/utils/api.js +++ b/app/react/utils/api.js @@ -1,4 +1,4 @@ -import { redirect } from 'react-router-dom'; +import { redirect } from 'react-router'; import { isClient } from 'app/utils'; import { notify } from 'app/Notifications/actions/notificationsActions'; import { store } from 'app/store'; diff --git a/app/react/utils/routeHelpers.ts b/app/react/utils/routeHelpers.ts index 8422cc0cc7..daa7e59807 100644 --- a/app/react/utils/routeHelpers.ts +++ b/app/react/utils/routeHelpers.ts @@ -1,4 +1,4 @@ -import { Location } from 'react-router-dom'; +import { Location } from 'react-router'; import { risonDecodeOrIgnore } from 'app/utils'; import { isArray } from 'lodash'; diff --git a/app/react/utils/specs/api.spec.js b/app/react/utils/specs/api.spec.js index d7cea4c5fc..aac853f4a0 100644 --- a/app/react/utils/specs/api.spec.js +++ b/app/react/utils/specs/api.spec.js @@ -11,8 +11,8 @@ import * as notifyActions from 'app/Notifications/actions/notificationsActions'; const mockRedirect = jest.fn(); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), +jest.mock('react-router', () => ({ + ...jest.requireActual('react-router'), redirect: jest.fn().mockImplementation(path => mockRedirect(path)), })); From f4b1ad8d9532b50966bee95f1b5a2f01af9ab02d Mon Sep 17 00:00:00 2001 From: John Date: Thu, 16 Jan 2025 12:29:21 -0300 Subject: [PATCH 05/34] add missing import update --- app/react/utils/test/renderConnected.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/react/utils/test/renderConnected.tsx b/app/react/utils/test/renderConnected.tsx index d83b8c37e6..d2f27e8a53 100644 --- a/app/react/utils/test/renderConnected.tsx +++ b/app/react/utils/test/renderConnected.tsx @@ -1,12 +1,11 @@ import React from 'react'; import { mount, ReactWrapper, shallow } from 'enzyme'; import configureStore, { MockStore, MockStoreCreator } from 'redux-mock-store'; -import { InitialEntry } from '@remix-run/router'; +import { BrowserRouter, MemoryRouter, InitialEntry } from 'react-router'; import { ConnectedComponent, Provider } from 'react-redux'; import thunk from 'redux-thunk'; import Immutable from 'immutable'; import { render, RenderResult } from '@testing-library/react'; -import { BrowserRouter, MemoryRouter } from 'react-router-dom'; const middlewares = [thunk]; const mockStoreCreator: MockStoreCreator = configureStore(middlewares); From 44d9ebbacb99789f354b61178505f6adb91aa042 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 16 Jan 2025 12:29:37 -0300 Subject: [PATCH 06/34] update dependabot ignores --- .github/dependabot.yml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 697fd9b5bf..3f4d12e43a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,33 +5,32 @@ updates: schedule: interval: daily ignore: - - dependency-name: "@types/*" - - dependency-name: "@sentry/node" #6880 - versions: [">= 7.114.0"] + - dependency-name: '@types/*' + - dependency-name: '@sentry/node' #6880 + versions: ['>= 7.114.0'] - dependency-name: flowbite #Flowbite & flowbite-datepicker upgrade #6993 - versions: [">= 2.3.1"] + versions: ['>= 2.3.1'] - dependency-name: flowbite-datepicker #Flowbite & flowbite-datepicker upgrade #6993 - versions: [">= 1.2.8"] + versions: ['>= 1.2.8'] - dependency-name: flowbite-react #Flowbite & flowbite-datepicker upgrade #6993 - versions: [">= 0.10.1"] + versions: ['>= 0.10.1'] - dependency-name: Mongoose #Mongoose upgrade #7017 - versions: [">= 8.4.3"] + versions: ['>= 8.4.3'] - dependency-name: cookie - - dependency-name: "@socket.io*" + - dependency-name: '@socket.io*' - dependency-name: bootstrap - dependency-name: express-prom-bundle - dependency-name: immutable - dependency-name: otplib - dependency-name: redux - dependency-name: redux-thunk - - dependency-name: "@typescript-eslint/eslint-plugin" - - dependency-name: "@typescript-eslint/parser" + - dependency-name: '@typescript-eslint/eslint-plugin' + - dependency-name: '@typescript-eslint/parser' - dependency-name: eslint #6784 - dependency-name: fetch-mock - - dependency-name: react-router-dom - dependency-name: react-datepicker - dependency-name: recharts - - dependency-name: "@headlessui/react" + - dependency-name: '@headlessui/react' - dependency-name: react-player open-pull-requests-limit: 5 labels: @@ -41,19 +40,19 @@ updates: babel: applies-to: version-updates patterns: - - "@babel*" + - '@babel*' storybook: applies-to: version-updates patterns: - - "@storybook*" + - '@storybook*' sentry: applies-to: version-updates patterns: - - "@sentry*" + - '@sentry*' dnd-kit: applies-to: version-updates patterns: - - "@dnd-kit*" + - '@dnd-kit*' socket.io: applies-to: version-updates patterns: @@ -70,9 +69,9 @@ updates: applies-to: version-updates update-types: [minor, patch] patterns: - - "*" + - '*' dev-major-dependencies: applies-to: version-updates update-types: [major] patterns: - - "*" + - '*' From d848ffba8142dc4bbf44c8c5b784111d500940a7 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 20 Jan 2025 12:57:14 -0300 Subject: [PATCH 07/34] relative splat path --- app/react/Routes.tsx | 8 ++++++-- app/react/entry-client.tsx | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/react/Routes.tsx b/app/react/Routes.tsx index 8240e25f09..18f10dba33 100644 --- a/app/react/Routes.tsx +++ b/app/react/Routes.tsx @@ -83,8 +83,12 @@ const getRoutesLayout = ( , settings)} /> , settings)} /> , settings)} /> - , settings)} /> - , settings)} /> + + , settings)} /> + + + , settings)} /> + , settings)} /> } /> } /> diff --git a/app/react/entry-client.tsx b/app/react/entry-client.tsx index 22407899fd..af9a965051 100644 --- a/app/react/entry-client.tsx +++ b/app/react/entry-client.tsx @@ -48,7 +48,12 @@ if (window.SENTRY_APP_DSN) { } const router = createBrowserRouter( - getRoutes(atomStore.get(settingsAtom), atomStore.get(userAtom)?._id) + getRoutes(atomStore.get(settingsAtom), atomStore.get(userAtom)?._id), + { + future: { + v7_relativeSplatPath: true, + }, + } ); const App = () => ( @@ -56,7 +61,7 @@ const App = () => ( - + From 6b825b6d46c811813e8d40375e1ee0c7df139e1b Mon Sep 17 00:00:00 2001 From: John Date: Mon, 20 Jan 2025 15:18:43 -0300 Subject: [PATCH 08/34] keep element defined in parent route --- app/react/Routes.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/react/Routes.tsx b/app/react/Routes.tsx index 18f10dba33..a3a090bb29 100644 --- a/app/react/Routes.tsx +++ b/app/react/Routes.tsx @@ -83,10 +83,10 @@ const getRoutesLayout = ( , settings)} /> , settings)} /> , settings)} /> - + , settings)}> , settings)} /> - + , settings)}> , settings)} /> , settings)} /> From 3291d32c2090640899181e51e60ad76fddbdf988 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 21 Jan 2025 10:57:10 -0300 Subject: [PATCH 09/34] wip await useNavigate and useRevalidator --- app/react/I18N/components/I18NLink.tsx | 14 +++++++------- app/react/Library/actions/libraryActions.js | 4 ++-- app/react/Markdown/components/SearchBox.js | 4 ++-- app/react/V2/Routes/Settings/Pages/PageEditor.tsx | 10 +++++----- .../V2/Routes/Settings/Thesauri/EditThesaurus.tsx | 4 ++-- .../V2/Routes/Settings/Thesauri/ThesaurusForm.tsx | 8 ++++---- .../Settings/Thesauri/components/ThesauriTable.tsx | 4 ++-- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/react/I18N/components/I18NLink.tsx b/app/react/I18N/components/I18NLink.tsx index 5841be31dc..e0ec9b3559 100644 --- a/app/react/I18N/components/I18NLink.tsx +++ b/app/react/I18N/components/I18NLink.tsx @@ -48,20 +48,20 @@ const I18NLink = (props: I18NLinkProps) => { }, delay); }; - const _navigate = () => { - navigate(to, { replace }); + const _navigate = async () => { + await navigate(to, { replace }); scrollToHashWithRetry(location.hash); }; - const onClickHandler = (e: { preventDefault: () => void }) => { + const onClickHandler = async (e: { preventDefault: () => void }) => { e.preventDefault(); if (disabled) return; if (onClick && confirmTitle) { props.mainContext.confirm({ - accept: () => { + accept: async () => { onClick(e); - _navigate(); + await _navigate(); }, title: confirmTitle, message: confirmMessage, @@ -71,10 +71,10 @@ const I18NLink = (props: I18NLinkProps) => { if (onClick) { onClick(e); - _navigate(); + await _navigate(); return; } - _navigate(); + await _navigate(); }; useEffect(() => { diff --git a/app/react/Library/actions/libraryActions.js b/app/react/Library/actions/libraryActions.js index 5bd66756e8..a27f35847b 100644 --- a/app/react/Library/actions/libraryActions.js +++ b/app/react/Library/actions/libraryActions.js @@ -231,7 +231,7 @@ function encodeSearch(_search, appendQ = true) { return appendQ ? `?q=${encodedSearch}` : encodedSearch; } -function setSearchInUrl(searchParams, location, navigate) { +async function setSearchInUrl(searchParams, location, navigate) { const { pathname } = location; const path = `${pathname}/`.replace(/\/\//g, '/'); const query = new URLSearchParams(location.search); @@ -246,7 +246,7 @@ function searchDocuments( limit = 30, from = 0 ) { - return (dispatch, getState) => { + return async (dispatch, getState) => { const state = getState().library; const currentSearch = search || state.search; const currentFilters = filters || state.filters; diff --git a/app/react/Markdown/components/SearchBox.js b/app/react/Markdown/components/SearchBox.js index 4bf5ea0942..b878084a83 100644 --- a/app/react/Markdown/components/SearchBox.js +++ b/app/react/Markdown/components/SearchBox.js @@ -11,8 +11,8 @@ import { SearchTipsContent } from 'app/App/SearchTipsContent'; const SearchBox = ({ placeholder, classname }) => { const navigate = useNavigate(); - const search = ({ searchTerm }) => { - navigate(`/library/?q=${rison.encode({ searchTerm })}`); + const search = async ({ searchTerm }) => { + await navigate(`/library/?q=${rison.encode({ searchTerm })}`); }; return ( diff --git a/app/react/V2/Routes/Settings/Pages/PageEditor.tsx b/app/react/V2/Routes/Settings/Pages/PageEditor.tsx index b8f0726a46..a4a1db5fb2 100644 --- a/app/react/V2/Routes/Settings/Pages/PageEditor.tsx +++ b/app/react/V2/Routes/Settings/Pages/PageEditor.tsx @@ -83,13 +83,13 @@ const PageEditor = () => { }); }; - const handleRevalidate = (response: Page) => { + const handleRevalidate = async (response: Page) => { if (!page.sharedId) { - navigate(`/${response.language}/settings/pages/page/${response.sharedId}`, { + await navigate(`/${response.language}/settings/pages/page/${response.sharedId}`, { replace: true, }); } else { - revalidator.revalidate(); + await revalidator.revalidate(); } }; @@ -106,7 +106,7 @@ const PageEditor = () => { notify(response); if (!hasErrors) { - handleRevalidate(response); + await handleRevalidate(response); } }; @@ -119,7 +119,7 @@ const PageEditor = () => { if (!hasErrors) { const pageUrl = getPageUrl(response.sharedId!, response.title); window.open(`${window.location.origin}/${pageUrl}`); - handleRevalidate(response); + await handleRevalidate(response); } }; diff --git a/app/react/V2/Routes/Settings/Thesauri/EditThesaurus.tsx b/app/react/V2/Routes/Settings/Thesauri/EditThesaurus.tsx index 42ba24df11..eb4e4b2c07 100644 --- a/app/react/V2/Routes/Settings/Thesauri/EditThesaurus.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/EditThesaurus.tsx @@ -168,13 +168,13 @@ const EditThesaurus = () => { }} disabled={isEmpty(getValues().name)} getThesaurus={getCurrentStatus} - onSuccess={(savedThesaurus: ThesaurusSchema) => { + onSuccess={async (savedThesaurus: ThesaurusSchema) => { setValue('_id', savedThesaurus._id); setNotifications({ type: 'success', text: Thesauri updated., }); - navigate(`../edit/${savedThesaurus._id}`); + await navigate(`../edit/${savedThesaurus._id}`); setIsImporting(false); }} onFailure={() => { diff --git a/app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx b/app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx index 93831f4285..1959914ff0 100644 --- a/app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx @@ -43,11 +43,11 @@ const ThesaurusForm = ({ const [thesauri, setThesauri] = useAtom(thesauriAtom); const setNotifications = useSetAtom(notificationAtom); - const handleRevalidate = (savedThesaurus: ClientThesaurus) => { + const handleRevalidate = async (savedThesaurus: ClientThesaurus) => { if (!thesaurus?._id) { - navigate(`../edit/${savedThesaurus._id}`); + await navigate(`../edit/${savedThesaurus._id}`); } else { - revalidator.revalidate(); + await revalidator.revalidate(); } }; @@ -68,7 +68,7 @@ const ThesaurusForm = ({ Thesauri added. ), }); - handleRevalidate(savedThesaurus); + await handleRevalidate(savedThesaurus); }; const formSubmit: SubmitHandler = async data => { diff --git a/app/react/V2/Routes/Settings/Thesauri/components/ThesauriTable.tsx b/app/react/V2/Routes/Settings/Thesauri/components/ThesauriTable.tsx index bcb1677042..580e05e026 100644 --- a/app/react/V2/Routes/Settings/Thesauri/components/ThesauriTable.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/components/ThesauriTable.tsx @@ -21,8 +21,8 @@ interface ThesauriTableProps { const ThesauriTable = ({ currentThesauri, setSelectedThesauri }: ThesauriTableProps) => { const navigate = useNavigate(); - const navigateToEditThesaurus = (thesaurus: Row) => { - navigate(`./edit/${thesaurus.original._id}`); + const navigateToEditThesaurus = async (thesaurus: Row) => { + await navigate(`./edit/${thesaurus.original._id}`); }; return ( From 54eccc43a49adae85fa05c8a702a65c3c1b354be Mon Sep 17 00:00:00 2001 From: John Date: Tue, 21 Jan 2025 11:17:08 -0300 Subject: [PATCH 10/34] await navigates and revalidators --- app/react/V2/Routes/Settings/Account/Account.tsx | 2 +- .../Account/Components/TwoFactorSetup.tsx | 2 +- .../V2/Routes/Settings/Collection/Collection.tsx | 2 +- .../Settings/CustomUploads/CustomUploads.tsx | 4 ++-- .../CustomUploads/components/DropzoneModal.tsx | 4 ++-- .../components/EditFileSidepanel.tsx | 2 +- .../V2/Routes/Settings/Filters/FiltersTable.tsx | 2 +- app/react/V2/Routes/Settings/IX/IXDashboard.tsx | 4 ++-- .../V2/Routes/Settings/IX/IXSuggestions.tsx | 16 +++++++++------- .../V2/Routes/Settings/MenuConfig/MenuConfig.tsx | 2 +- app/react/V2/Routes/Settings/Pages/PagesList.tsx | 2 +- .../ParagraphExtraction/ParagraphExtraction.tsx | 4 ++-- .../RelationshipTypes/RelationshipTypes.tsx | 4 ++-- .../V2/Routes/Settings/Thesauri/ThesauriList.tsx | 2 +- 14 files changed, 27 insertions(+), 25 deletions(-) diff --git a/app/react/V2/Routes/Settings/Account/Account.tsx b/app/react/V2/Routes/Settings/Account/Account.tsx index 7b93bead71..69190dc09a 100644 --- a/app/react/V2/Routes/Settings/Account/Account.tsx +++ b/app/react/V2/Routes/Settings/Account/Account.tsx @@ -62,7 +62,7 @@ const Account = () => { type: 'success', text: Account updated, }); - revalidator.revalidate(); + await revalidator.revalidate(); } resetField('password'); diff --git a/app/react/V2/Routes/Settings/Account/Components/TwoFactorSetup.tsx b/app/react/V2/Routes/Settings/Account/Components/TwoFactorSetup.tsx index 18135674d4..7085cf785c 100644 --- a/app/react/V2/Routes/Settings/Account/Components/TwoFactorSetup.tsx +++ b/app/react/V2/Routes/Settings/Account/Components/TwoFactorSetup.tsx @@ -57,7 +57,7 @@ const TwoFactorSetup = ({ closePanel, isOpen }: TwoFactorSetupProps) => { const enable2fa = async () => { try { await api.post('auth2fa-enable', new RequestParams({ token })); - revalidator.revalidate(); + await revalidator.revalidate(); closePanel(); setNotifications({ type: 'success', diff --git a/app/react/V2/Routes/Settings/Collection/Collection.tsx b/app/react/V2/Routes/Settings/Collection/Collection.tsx index 112309876e..0ce9059103 100644 --- a/app/react/V2/Routes/Settings/Collection/Collection.tsx +++ b/app/react/V2/Routes/Settings/Collection/Collection.tsx @@ -112,7 +112,7 @@ const Collection = () => { text: Settings updated, }); } - revalidator.revalidate(); + await revalidator.revalidate(); }; const labelWithTip = (label: string, tip: React.ReactNode) => ( diff --git a/app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx b/app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx index ad78aead3e..f6c2571d0c 100644 --- a/app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx +++ b/app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx @@ -93,7 +93,7 @@ const CustomUploads = () => { setConfirmationModal(false); const response = await remove(file._id); notify([response], Deleted custom file); - revalidator.revalidate(); + await revalidator.revalidate(); }, }); }; @@ -104,7 +104,7 @@ const CustomUploads = () => { setSelectedRows([]); const responses = await Promise.all(filesToDelete.map(async fileId => remove(fileId))); notify(responses, Deleted custom file); - revalidator.revalidate(); + await revalidator.revalidate(); }; return ( diff --git a/app/react/V2/Routes/Settings/CustomUploads/components/DropzoneModal.tsx b/app/react/V2/Routes/Settings/CustomUploads/components/DropzoneModal.tsx index f92f2ea73e..67271d9a57 100644 --- a/app/react/V2/Routes/Settings/CustomUploads/components/DropzoneModal.tsx +++ b/app/react/V2/Routes/Settings/CustomUploads/components/DropzoneModal.tsx @@ -31,8 +31,8 @@ const DropzoneModal = ({ notify, isOpen, setIsOpen, uploadService }: DropzoneMod uploadService.onProgress((filename, progress) => { updateProgress({ filename, progress }); }); - uploadService.onUploadComplete(() => { - revalidator.revalidate(); + uploadService.onUploadComplete(async () => { + await revalidator.revalidate(); }); const results = await uploadService.upload([...filesToUpload]); updateProgress({ filename: undefined, progress: undefined }); diff --git a/app/react/V2/Routes/Settings/CustomUploads/components/EditFileSidepanel.tsx b/app/react/V2/Routes/Settings/CustomUploads/components/EditFileSidepanel.tsx index bfc19b2678..e3cfe7b307 100644 --- a/app/react/V2/Routes/Settings/CustomUploads/components/EditFileSidepanel.tsx +++ b/app/react/V2/Routes/Settings/CustomUploads/components/EditFileSidepanel.tsx @@ -58,7 +58,7 @@ const EditFileSidepanel = ({ showSidepanel, closeSidepanel, file }: EditFileSide const response = await update(updatedFile); closeSidepanel(); notify(response); - revalidator.revalidate(); + await revalidator.revalidate(); }; return ( diff --git a/app/react/V2/Routes/Settings/Filters/FiltersTable.tsx b/app/react/V2/Routes/Settings/Filters/FiltersTable.tsx index fdb75c9eb2..98b99c3d1d 100644 --- a/app/react/V2/Routes/Settings/Filters/FiltersTable.tsx +++ b/app/react/V2/Routes/Settings/Filters/FiltersTable.tsx @@ -114,7 +114,7 @@ const FiltersTable = () => { setSettings(response); setDisabled(false); setHasChanges(false); - revalidator.revalidate(); + await revalidator.revalidate(); return setNotifications({ type: 'success', text: Filters saved }); }; diff --git a/app/react/V2/Routes/Settings/IX/IXDashboard.tsx b/app/react/V2/Routes/Settings/IX/IXDashboard.tsx index d8a49eebc4..44c5d4b296 100644 --- a/app/react/V2/Routes/Settings/IX/IXDashboard.tsx +++ b/app/react/V2/Routes/Settings/IX/IXDashboard.tsx @@ -71,7 +71,7 @@ const IXDashboard = () => { try { await extractorsAPI.remove(extractorIds); - revalidator.revalidate(); + await revalidator.revalidate(); setNotifications({ type: 'success', text: Extractor/s deleted, @@ -92,7 +92,7 @@ const IXDashboard = () => { try { await extractorsAPI.save(extractor); - revalidator.revalidate(); + await revalidator.revalidate(); setNotifications({ type: 'success', text: Saved successfully., diff --git a/app/react/V2/Routes/Settings/IX/IXSuggestions.tsx b/app/react/V2/Routes/Settings/IX/IXSuggestions.tsx index 8b3acd3c44..6088d97da0 100644 --- a/app/react/V2/Routes/Settings/IX/IXSuggestions.tsx +++ b/app/react/V2/Routes/Settings/IX/IXSuggestions.tsx @@ -124,10 +124,10 @@ const IXSuggestions = () => { useEffect(() => { socket.on( 'ix_model_status', - (extractorId: string, modelStatus: string, _: string, data: any) => { + async (extractorId: string, modelStatus: string, _: string, data: any) => { if (extractorId === extractor._id) { setStatus({ status: modelStatus as ixStatus, data }); - revalidate(); + await revalidate(); if ((data && data.total === data.processed) || modelStatus === 'ready') { setStatus({ status: 'ready' }); } @@ -145,8 +145,10 @@ const IXSuggestions = () => { }, [aggregation]); useEffect(() => { + const navigatePromise = async (path: string) => navigate(path, { replace: true }); + if (searchParams.has('sort') && !sorting.length) { - navigate(location.pathname, { replace: true }); + navigatePromise(location.pathname).catch(_e => {}); } if (sorting.length && sorting[0].id) { @@ -158,9 +160,9 @@ const IXSuggestions = () => { const order = sorting[0].desc ? 'desc' : 'asc'; - navigate(`${location.pathname}?sort={"property":"${_property}","order":"${order}"}`, { - replace: true, - }); + navigatePromise( + `${location.pathname}?sort={"property":"${_property}","order":"${order}"}` + ).catch(_e => {}); } }, [sorting]); @@ -225,7 +227,7 @@ const IXSuggestions = () => { } else { setStatus({ status: 'cancel' }); } - revalidate(); + await revalidate(); } } catch (error) {} }; diff --git a/app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx b/app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx index 92dde189db..c44d65a4d3 100644 --- a/app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx +++ b/app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx @@ -69,7 +69,7 @@ const MenuConfig = () => { const save = async () => { const settings = await SettingsAPI.saveLinks(linkState.map(sanitizeIds)); setSettings(settings); - revalidator.revalidate(); + await revalidator.revalidate(); setNotifications({ type: 'success', text: Updated, diff --git a/app/react/V2/Routes/Settings/Pages/PagesList.tsx b/app/react/V2/Routes/Settings/Pages/PagesList.tsx index 4b5f67fc7a..8f16613b50 100644 --- a/app/react/V2/Routes/Settings/Pages/PagesList.tsx +++ b/app/react/V2/Routes/Settings/Pages/PagesList.tsx @@ -55,7 +55,7 @@ const PagesList = () => { ); const hasErrors = result.find(res => res instanceof FetchResponseError) !== undefined; setNotifications(deletionNotification(hasErrors)); - revalidator.revalidate(); + await revalidator.revalidate(); }; const columns = [ diff --git a/app/react/V2/Routes/Settings/ParagraphExtraction/ParagraphExtraction.tsx b/app/react/V2/Routes/Settings/ParagraphExtraction/ParagraphExtraction.tsx index 10ab988f92..37530642bf 100644 --- a/app/react/V2/Routes/Settings/ParagraphExtraction/ParagraphExtraction.tsx +++ b/app/react/V2/Routes/Settings/ParagraphExtraction/ParagraphExtraction.tsx @@ -52,7 +52,7 @@ const ParagraphExtractorDashboard = () => { try { await extractorsAPI.remove(extractorIds); - revalidator.revalidate(); + await revalidator.revalidate(); setNotifications({ type: 'success', text: Extractor/s deleted, @@ -69,7 +69,7 @@ const ParagraphExtractorDashboard = () => { }; const handleSave = async () => { - revalidator.revalidate(); + await revalidator.revalidate(); setNotifications({ type: 'success', text: Paragraph Extractor added, diff --git a/app/react/V2/Routes/Settings/RelationshipTypes/RelationshipTypes.tsx b/app/react/V2/Routes/Settings/RelationshipTypes/RelationshipTypes.tsx index e00d5f00e7..7e12ccf877 100644 --- a/app/react/V2/Routes/Settings/RelationshipTypes/RelationshipTypes.tsx +++ b/app/react/V2/Routes/Settings/RelationshipTypes/RelationshipTypes.tsx @@ -86,7 +86,7 @@ const RelationshipTypes = () => { }); setIsSidepanelOpen(false); } - revalidator.revalidate(); + await revalidator.revalidate(); setRelationshipTypes(relationshipTypes); }; @@ -106,7 +106,7 @@ const RelationshipTypes = () => { }); setShowConfirmationModal(false); } - revalidator.revalidate(); + await revalidator.revalidate(); setRelationshipTypes(relationshipTypes); }; diff --git a/app/react/V2/Routes/Settings/Thesauri/ThesauriList.tsx b/app/react/V2/Routes/Settings/Thesauri/ThesauriList.tsx index 1b1f11caf7..34d3fce905 100644 --- a/app/react/V2/Routes/Settings/Thesauri/ThesauriList.tsx +++ b/app/react/V2/Routes/Settings/Thesauri/ThesauriList.tsx @@ -62,7 +62,7 @@ const ThesauriList = () => { text: e.message, }); } finally { - revalidator.revalidate(); + await revalidator.revalidate(); setShowConfirmationModal(false); } }; From 038167d8fd7d0bcc3c9528c090c103ac9aefbcf0 Mon Sep 17 00:00:00 2001 From: mfacar Date: Wed, 22 Jan 2025 11:19:44 -0500 Subject: [PATCH 11/34] sets TextEncoder/TextDecoder for jsdom in jest config --- app/setUpJestClient.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/setUpJestClient.js b/app/setUpJestClient.js index 05aa88079f..0018174d49 100644 --- a/app/setUpJestClient.js +++ b/app/setUpJestClient.js @@ -1,7 +1,10 @@ /* eslint-disable import/no-extraneous-dependencies */ import '@testing-library/jest-dom'; +import { TextEncoder, TextDecoder } from 'util'; import Adapter from '@cfaester/enzyme-adapter-react-18'; +Object.assign(global, { TextDecoder, TextEncoder }); + const { configure } = require('enzyme'); configure({ adapter: new Adapter() }); From cca70da423847b84069da7eb840abf2d136d12ef Mon Sep 17 00:00:00 2001 From: mfacar Date: Wed, 22 Jan 2025 21:28:25 -0500 Subject: [PATCH 12/34] updates snapshots --- .../__snapshots__/SortDropdown.spec.tsx.snap | 10 ++++++++++ .../__snapshots__/Thesauri.spec.tsx.snap | 19 ++----------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/app/react/Library/components/specs/__snapshots__/SortDropdown.spec.tsx.snap b/app/react/Library/components/specs/__snapshots__/SortDropdown.spec.tsx.snap index 94f5d5f137..9d4879b0a8 100644 --- a/app/react/Library/components/specs/__snapshots__/SortDropdown.spec.tsx.snap +++ b/app/react/Library/components/specs/__snapshots__/SortDropdown.spec.tsx.snap @@ -37,6 +37,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • Title @@ -45,6 +46,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • Date added @@ -53,6 +55,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • Date modified @@ -61,6 +64,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • Search relevance @@ -69,6 +73,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • Date @@ -77,6 +82,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • Number @@ -85,6 +91,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • My select @@ -93,6 +100,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • Sortable name @@ -101,6 +109,7 @@ exports[`Sort dropdown when there is an active search term should display sort b
  • Inherited 1 @@ -110,6 +119,7 @@ exports[`Sort dropdown when there is an active search term should display sort b diff --git a/app/react/V2/Routes/Settings/Thesauri/specs/__snapshots__/Thesauri.spec.tsx.snap b/app/react/V2/Routes/Settings/Thesauri/specs/__snapshots__/Thesauri.spec.tsx.snap index 89d8ef512f..a03bdaac68 100644 --- a/app/react/V2/Routes/Settings/Thesauri/specs/__snapshots__/Thesauri.spec.tsx.snap +++ b/app/react/V2/Routes/Settings/Thesauri/specs/__snapshots__/Thesauri.spec.tsx.snap @@ -269,6 +269,7 @@ exports[`Settings Thesauri ThesauriList render existing thesauri should show a l > - -