Skip to content

The open alternative to Salesforce, designed for AI.

Upgrade react-router to 7.18.4 (#26232)

Charles Bochete0434d466763
diff --git a/packages/twenty-front-component-renderer/jest.setup.mjs b/packages/twenty-front-component-renderer/jest.setup.mjs
index 1c93e8e30d7..95111bd565c 100644
--- a/packages/twenty-front-component-renderer/jest.setup.mjs
+++ b/packages/twenty-front-component-renderer/jest.setup.mjs
@@ -1,5 +1,12 @@
+import { TextDecoder, TextEncoder } from 'node:util';
import { deserialize, serialize } from 'node:v8';
if (typeof globalThis.structuredClone !== 'function') {
globalThis.structuredClone = (value) => deserialize(serialize(value));
}
+
+// jsdom has no TextEncoder/TextDecoder, and react-router (reached through
+// twenty-shared/utils) references them while being imported.
+if (globalThis.TextEncoder === undefined) {
+ Object.assign(globalThis, { TextDecoder, TextEncoder });
+}
diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.json
index 95a0c38d129..af3da2a58f3 100644
--- a/packages/twenty-front/package.json
+++ b/packages/twenty-front/package.json
@@ -135,7 +135,7 @@
"react-phone-number-input": "patch:react-phone-number-input@npm%3A3.4.5#../../.yarn/patches/react-phone-number-input-npm-3.4.5-dc2895c306.patch",
"react-qr-code": "^2.0.18",
"react-responsive": "^9.0.2",
- "react-router-dom": "^6.30.6",
+ "react-router-dom": "^7.18.4",
"react-textarea-autosize": "^8.4.1",
"remark-gfm": "^4.0.1",
"rxjs": "^7.2.0",
diff --git a/packages/twenty-front/src/modules/app/components/DomainShell.tsx b/packages/twenty-front/src/modules/app/components/DomainShell.tsx
index 55ab0dd1433..dbfe6d229af 100644
--- a/packages/twenty-front/src/modules/app/components/DomainShell.tsx
+++ b/packages/twenty-front/src/modules/app/components/DomainShell.tsx
@@ -20,7 +20,7 @@ export const DomainShell = () => {
if (!isLoadedOnce) {
return (
- <BrowserRouter>
+ <BrowserRouter useTransitions={false}>
<SharedAppProviders>
{isOnOnboardingTransitionPath(window.location.pathname) ? (
<OnboardingPageLoader />
diff --git a/packages/twenty-front/src/modules/app/components/RootApp.tsx b/packages/twenty-front/src/modules/app/components/RootApp.tsx
index a687dcca0e0..0450ded6fd8 100644
--- a/packages/twenty-front/src/modules/app/components/RootApp.tsx
+++ b/packages/twenty-front/src/modules/app/components/RootApp.tsx
@@ -3,5 +3,7 @@ import { RouterProvider } from 'react-router-dom';
import { useCreateRootAppRouter } from '@/app/hooks/useCreateRootAppRouter';
export const RootApp = () => {
- return <RouterProvider router={useCreateRootAppRouter()} />;
+ return (
+ <RouterProvider router={useCreateRootAppRouter()} useTransitions={false} />
+ );
};
diff --git a/packages/twenty-front/src/modules/app/components/WorkspaceApp.tsx b/packages/twenty-front/src/modules/app/components/WorkspaceApp.tsx
index 5e79cda0fc1..939f0bcb28f 100644
--- a/packages/twenty-front/src/modules/app/components/WorkspaceApp.tsx
+++ b/packages/twenty-front/src/modules/app/components/WorkspaceApp.tsx
@@ -19,6 +19,7 @@ export const WorkspaceApp = () => {
return (
<RouterProvider
+ useTransitions={false}
router={useCreateWorkspaceAppRouter({
isAdminPageEnabled,
isWorkflowCoreIndexPageEnabled,
diff --git a/packages/twenty-front/src/modules/side-panel/components/__tests__/SidePanelToggleButton.test.tsx b/packages/twenty-front/src/modules/side-panel/components/__tests__/SidePanelToggleButton.test.tsx
index 0491b90eee7..b032d3fec13 100644
--- a/packages/twenty-front/src/modules/side-panel/components/__tests__/SidePanelToggleButton.test.tsx
+++ b/packages/twenty-front/src/modules/side-panel/components/__tests__/SidePanelToggleButton.test.tsx
@@ -52,12 +52,7 @@ const renderSidePanelToggleButton = ({
render(
<I18nProvider i18n={i18n}>
<JotaiProvider store={store}>
- <MemoryRouter
- future={{
- v7_relativeSplatPath: true,
- v7_startTransition: true,
- }}
- >
+ <MemoryRouter>
<SidePanelToggleButton />
</MemoryRouter>
</JotaiProvider>
diff --git a/packages/twenty-front/src/testing/decorators/ComponentWithRouterDecorator.tsx b/packages/twenty-front/src/testing/decorators/ComponentWithRouterDecorator.tsx
index ec0f5ca5276..60df7428ba9 100644
--- a/packages/twenty-front/src/testing/decorators/ComponentWithRouterDecorator.tsx
+++ b/packages/twenty-front/src/testing/decorators/ComponentWithRouterDecorator.tsx
@@ -50,6 +50,7 @@ const createRouter = ({
export const ComponentWithRouterDecorator: Decorator = (Story, { args }) => {
return (
<RouterProvider
+ useTransitions={false}
router={createRouter({
Story,
args,
diff --git a/packages/twenty-front/src/testing/decorators/PageDecorator.tsx b/packages/twenty-front/src/testing/decorators/PageDecorator.tsx
index c773844d584..2422163bef6 100644
--- a/packages/twenty-front/src/testing/decorators/PageDecorator.tsx
+++ b/packages/twenty-front/src/testing/decorators/PageDecorator.tsx
@@ -172,6 +172,7 @@ export const PageDecorator: Decorator<{
}> = (Story, { args }) => {
return (
<RouterProvider
+ useTransitions={false}
router={createRouter({
Story,
args,
diff --git a/packages/twenty-shared/package.json b/packages/twenty-shared/package.json
index 284c7ca429e..e59591b3f37 100644
--- a/packages/twenty-shared/package.json
+++ b/packages/twenty-shared/package.json
@@ -54,7 +54,7 @@
"lodash.escaperegexp": "^4.1.2",
"microdiff": "^1.3.2",
"qs": "^6.15.2",
- "react-router-dom": "^6.30.6",
+ "react-router-dom": "^7.18.4",
"temporal-polyfill": "^0.3.0",
"transliteration": "^2.3.5",
"uuid": "^11.1.1",
diff --git a/packages/twenty-shared/src/utils/navigation/getAppPath.ts b/packages/twenty-shared/src/utils/navigation/getAppPath.ts
index e95e416cb37..000dbe3e936 100644
--- a/packages/twenty-shared/src/utils/navigation/getAppPath.ts
+++ b/packages/twenty-shared/src/utils/navigation/getAppPath.ts
@@ -11,7 +11,7 @@ export const getAppPath = <T extends AppPath>(
let path: string = to;
if (isDefined(params)) {
- path = generatePath<T>(to, params);
+ path = generatePath(path, params);
}
if (isDefined(queryParams)) {
diff --git a/packages/twenty-shared/src/utils/navigation/getSettingsPath.ts b/packages/twenty-shared/src/utils/navigation/getSettingsPath.ts
index 01a4cbb9f68..41a6a40522a 100644
--- a/packages/twenty-shared/src/utils/navigation/getSettingsPath.ts
+++ b/packages/twenty-shared/src/utils/navigation/getSettingsPath.ts
@@ -14,10 +14,7 @@ export const getSettingsPath = <T extends SettingsPath>(
let path = `/${AppPath.Settings}/${to}`;
if (isDefined(params)) {
- path = generatePath<`/${AppPath.Settings}/${T}`>(
- `/${AppPath.Settings}/${to}`,
- params,
- );
+ path = generatePath(path, params);
}
if (isDefined(queryParams)) {
diff --git a/packages/twenty-ui/package.json b/packages/twenty-ui/package.json
index d9809e981a1..aa3d9dc2355 100644
--- a/packages/twenty-ui/package.json
+++ b/packages/twenty-ui/package.json
@@ -78,7 +78,7 @@
"@tabler/icons-react": "^3.31.0",
"clsx": "^2.1.1",
"react-responsive": "^9.0.2",
- "react-router-dom": "^6.30.6",
+ "react-router-dom": "^7.18.4",
"type-fest": "^4.10.1",
"zod": "^4.1.11"
},
diff --git a/packages/twenty-ui/src/testing/decorators/ComponentWithRouterDecorator.tsx b/packages/twenty-ui/src/testing/decorators/ComponentWithRouterDecorator.tsx
index 3fd39a34ee3..437fe85187f 100644
--- a/packages/twenty-ui/src/testing/decorators/ComponentWithRouterDecorator.tsx
+++ b/packages/twenty-ui/src/testing/decorators/ComponentWithRouterDecorator.tsx
@@ -68,6 +68,7 @@ const createRouter = ({
export const ComponentWithRouterDecorator: Decorator = (Story, { args }) => {
return (
<RouterProvider
+ useTransitions={false}
router={createRouter({
Story,
args,
diff --git a/yarn.lock b/yarn.lock
index e85af6c9a35..975327fd9e9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -15587,13 +15587,6 @@ __metadata:
languageName: node
linkType: hard
-"@remix-run/router@npm:1.23.4":
- version: 1.23.4
- resolution: "@remix-run/router@npm:1.23.4"
- checksum: 10c0/ef17eb2a606c125f09c55683585099725421af1c11f1c1d1c3841fe4eea3f99eb56b26ecbb17429a173c704ecae336c37e0d74855faa9330667433ef4f419436
- languageName: node
- linkType: hard
-
"@remote-dom/core@npm:^1.10.1, @remote-dom/core@npm:^1.7.0":
version: 1.10.1
resolution: "@remote-dom/core@npm:1.10.1"
@@ -27758,7 +27751,7 @@ __metadata:
languageName: node
linkType: hard
-"cookie@npm:^1.0.2":
+"cookie@npm:^1.0.1, cookie@npm:^1.0.2":
version: 1.1.1
resolution: "cookie@npm:1.1.1"
checksum: 10c0/79c4ddc0fcad9c4f045f826f42edf54bcc921a29586a4558b0898277fa89fb47be95bc384c2253f493af7b29500c830da28341274527328f18eba9f58afa112c
@@ -44679,27 +44672,31 @@ __metadata:
languageName: node
linkType: hard
-"react-router-dom@npm:^6.30.6":
- version: 6.30.6
- resolution: "react-router-dom@npm:6.30.6"
+"react-router-dom@npm:^7.18.4":
+ version: 7.18.4
+ resolution: "react-router-dom@npm:7.18.4"
dependencies:
- "@remix-run/router": "npm:1.23.4"
- react-router: "npm:6.30.6"
+ react-router: "npm:7.18.4"
peerDependencies:
- react: ">=16.8"
- react-dom: ">=16.8"
- checksum: 10c0/57dbb2ae4ac787f78c4d10b764c1c5223635378033e33dda4e0a4417144ae847fb43dc98008075951826258287c27c67729ca713c90957cf2ecf9055561bdc2e
+ react: ">=18"
+ react-dom: ">=18"
+ checksum: 10c0/b337acffb669fd977423e3ef2a0551a5d68c2447c718942b232cae367fd599723525e412b4ad0d08607189f962571dfc7ef0373d47fcf0ae301a860510e5e1f1
languageName: node
linkType: hard
-"react-router@npm:6.30.6":
- version: 6.30.6
- resolution: "react-router@npm:6.30.6"
+"react-router@npm:7.18.4":
+ version: 7.18.4
+ resolution: "react-router@npm:7.18.4"
dependencies:
- "@remix-run/router": "npm:1.23.4"
+ cookie: "npm:^1.0.1"
+ set-cookie-parser: "npm:^2.6.0"
peerDependencies:
- react: ">=16.8"
- checksum: 10c0/d101388d92a44e159ef30dd2402a7f7b6aace8f837bb42aed1f8a6b3a4eff769d1822bf69382f0acb85a790628dac081c22bedb2bca12707e0e5e91427010fc3
+ react: ">=18"
+ react-dom: ">=18"
+ peerDependenciesMeta:
+ react-dom:
+ optional: true
+ checksum: 10c0/352d103f9d738c7bf56cbb135c0d3d44e6325d15e360f58b6e844c1f5f8cbcd4ccb2de347f14e53984683fc237505a045633e9cb92c5457a1162dae054e08a32
languageName: node
linkType: hard
@@ -47030,6 +47027,13 @@ __metadata:
languageName: node
linkType: hard
+"set-cookie-parser@npm:^2.6.0":
+ version: 2.7.2
+ resolution: "set-cookie-parser@npm:2.7.2"
+ checksum: 10c0/4381a9eb7ee951dfe393fe7aacf76b9a3b4e93a684d2162ab35594fa4053cc82a4d7d7582bf397718012c9adcf839b8cd8f57c6c42901ea9effe33c752da4a45
+ languageName: node
+ linkType: hard
+
"set-function-length@npm:^1.2.2":
version: 1.2.2
resolution: "set-function-length@npm:1.2.2"
@@ -50154,7 +50158,7 @@ __metadata:
react-phone-number-input: "patch:react-phone-number-input@npm%3A3.4.5#../../.yarn/patches/react-phone-number-input-npm-3.4.5-dc2895c306.patch"
react-qr-code: "npm:^2.0.18"
react-responsive: "npm:^9.0.2"
- react-router-dom: "npm:^6.30.6"
+ react-router-dom: "npm:^7.18.4"
react-textarea-autosize: "npm:^8.4.1"
remark-gfm: "npm:^4.0.1"
rollup-plugin-node-polyfills: "npm:^0.2.1"
@@ -50490,7 +50494,7 @@ __metadata:
microdiff: "npm:^1.3.2"
prettier: "npm:^3.1.1"
qs: "npm:^6.15.2"
- react-router-dom: "npm:^6.30.6"
+ react-router-dom: "npm:^7.18.4"
slash: "npm:^5.1.0"
temporal-polyfill: "npm:^0.3.0"
transliteration: "npm:^2.3.5"
@@ -50543,7 +50547,7 @@ __metadata:
react-docgen-typescript: "npm:^2.2.2"
react-dom: "npm:^19.2.0"
react-responsive: "npm:^9.0.2"
- react-router-dom: "npm:^6.30.6"
+ react-router-dom: "npm:^7.18.4"
sass: "npm:^1.83.0"
sass-embedded: "npm:^1.83.0"
size-limit: "npm:^12.1.0"