Skip to content

Commit

Permalink
bump dependency react-router to unpatched ^7.2.0 (#430)
Browse files Browse the repository at this point in the history
* bump dependency `react-router` to unpatched `^7.3.0`

* require `7.2.0-pre.3`

* changeset

* update some more deps

* adjust install steps in test CI
  • Loading branch information
phryneas authored Feb 17, 2025
1 parent 479a3c7 commit 2f4890a
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 287 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-cherries-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client-integration-react-router": patch
---

Set minimal version of React Router to 7.2.0-pre.3, removes need for patching.
14 changes: 10 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ jobs:
with:
node-version: "20.11.0"
cache: "yarn"
- run: yarn install --immutable --mode=skip-build
- run: yarn workspaces foreach --all --include "@apollo/*" add -D -P @apollo/client@${{ matrix.version }}
- name: Set target version of Apollo Client (Root)
run: npm pkg set resolutions.@apollo/client=$(npm view @apollo/client@${{ matrix.version }} version)
- run: yarn install --mode=skip-build
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
- run: yarn workspaces foreach --all --include "@apollo/*" run build
- run: yarn workspaces foreach --all --include "@apollo/*" run test | tee $GITHUB_STEP_SUMMARY; exit ${PIPESTATUS[0]}
packageShapes:
Expand All @@ -64,8 +67,11 @@ jobs:
with:
node-version: "20.x"
cache: "yarn"
- run: yarn install --immutable --mode=skip-build
- run: yarn workspaces foreach --all --include "@apollo/*" add -D -P @apollo/client@${{ matrix.version }}
- name: Set target version of Apollo Client (Root)
run: npm pkg set resolutions.@apollo/client=$(npm view @apollo/client@${{ matrix.version }} version)
- run: yarn install --mode=skip-build
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
- run: yarn workspaces foreach --all -t --include "@apollo/*" run test-bundle | tee $GITHUB_STEP_SUMMARY; exit ${PIPESTATUS[0]}
tests_playwright:
name: Integration Tests
Expand Down
10 changes: 5 additions & 5 deletions integration-test/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
"@apollo/client": "^3.11.10",
"@apollo/client-integration-react-router": "workspace:^",
"@integration-test/shared": "workspace:^",
"@react-router/fs-routes": "^7.1.5",
"@react-router/node": "^7.1.5",
"@react-router/serve": "^7.1.5",
"@react-router/fs-routes": "^7.2.0-pre.3",
"@react-router/node": "^7.2.0-pre.3",
"@react-router/serve": "^7.2.0-pre.3",
"@vercel/react-router": "^1.0.2",
"graphql": "*",
"isbot": "^5.1.17",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7.1.5"
"react-router": "^7.2.0-pre.3"
},
"devDependencies": {
"@react-router/dev": "^7.1.5",
"@react-router/dev": "^7.2.0-pre.3",
"@tailwindcss/vite": "^4.0.0",
"@types/node": "^20",
"@types/react": "^19.0.1",
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"resolutions": {
"@microsoft/api-documenter": "7.24.1",
"graphql": "17.0.0-alpha.2",
"react-router": "patch:react-router@npm%3A7.1.5#~/.yarn/patches/react-router-npm-7.1.5-9668fa2213.patch",
"@tanstack/start": "1.99.6",
"@tanstack/react-router": "1.99.6",
"@tanstack/start-router-manifest": "1.99.0",
Expand Down
213 changes: 0 additions & 213 deletions packages/react-router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,219 +98,6 @@ export function Layout({ children }: { children: React.ReactNode }) {
}
```

### Temporary: patch React-Router

We are still waiting for a PR to React Router to get merged: https://github.com/remix-run/react-router/pull/12264

In the meantime, you unfortunately have to use something like `patch-package` or `yarn patch` to pull in that PR on your own. No worries, it's just a small type adjustment, so nothing scary!

You can use one of these patches:

<details>
<summary>with <code>yarn patch</code>: <code>.yarn/patches/react-router-npm-7.0.2-b96f2bd13c.patch</code></summary>

```diff
diff --git a/dist/development/lib/types/route-module.d.mts b/dist/development/lib/types/route-module.d.mts
index c4553062633a6a1352378bfedb2c9dc7eaef94fb..762fd83a1ad06f940ba39c6552bd61cc5c4d1cf1 100644
--- a/dist/development/lib/types/route-module.d.mts
+++ b/dist/development/lib/types/route-module.d.mts
@@ -1,7 +1,9 @@
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.mjs';
import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
import 'react';
-
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
type RouteModule = {
meta?: Func;
diff --git a/dist/development/lib/types/route-module.d.ts b/dist/development/lib/types/route-module.d.ts
index a7b3449b84f7be4e7da9ce82ba6ac3ae3e30d64f..776fdbc13033eb82ce4de2b9026476e87e65c7f7 100644
--- a/dist/development/lib/types/route-module.d.ts
+++ b/dist/development/lib/types/route-module.d.ts
@@ -1,7 +1,9 @@
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.js';
import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
import 'react';
-
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
type RouteModule = {
meta?: Func;
diff --git a/dist/development/route-data-DuV3tXo2.d.mts b/dist/development/route-data-DuV3tXo2.d.mts
index 53dbfb38b8c2cd09bb944aeb17dd3951f2a157ad..d33adfc7147222f4e283487df804faeb95f2a4c8 100644
--- a/dist/development/route-data-DuV3tXo2.d.mts
+++ b/dist/development/route-data-DuV3tXo2.d.mts
@@ -1531,8 +1531,10 @@ type Func = (...args: any[]) => unknown;
type Pretty<T> = {
[K in keyof T]: T[K];
} & {};
-
-type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
+type Serialize<T> = T extends SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
[K in keyof T]: Serialize<T[K]>;
} : undefined;
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
diff --git a/dist/development/route-data-DuV3tXo2.d.ts b/dist/development/route-data-DuV3tXo2.d.ts
index 53dbfb38b8c2cd09bb944aeb17dd3951f2a157ad..d33adfc7147222f4e283487df804faeb95f2a4c8 100644
--- a/dist/development/route-data-DuV3tXo2.d.ts
+++ b/dist/development/route-data-DuV3tXo2.d.ts
@@ -1531,8 +1531,10 @@ type Func = (...args: any[]) => unknown;
type Pretty<T> = {
[K in keyof T]: T[K];
} & {};
-
-type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
+type Serialize<T> = T extends SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
[K in keyof T]: Serialize<T[K]>;
} : undefined;
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
diff --git a/dist/production/lib/types/route-module.d.mts b/dist/production/lib/types/route-module.d.mts
index c4553062633a6a1352378bfedb2c9dc7eaef94fb..762fd83a1ad06f940ba39c6552bd61cc5c4d1cf1 100644
--- a/dist/production/lib/types/route-module.d.mts
+++ b/dist/production/lib/types/route-module.d.mts
@@ -1,7 +1,9 @@
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.mjs';
import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
import 'react';
-
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
type RouteModule = {
meta?: Func;
diff --git a/dist/production/lib/types/route-module.d.ts b/dist/production/lib/types/route-module.d.ts
index a7b3449b84f7be4e7da9ce82ba6ac3ae3e30d64f..776fdbc13033eb82ce4de2b9026476e87e65c7f7 100644
--- a/dist/production/lib/types/route-module.d.ts
+++ b/dist/production/lib/types/route-module.d.ts
@@ -1,7 +1,9 @@
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.js';
import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
import 'react';
-
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
type RouteModule = {
meta?: Func;
```

</details>

<details>
<summary>with <code>patch-package</code>: <code>patches/react-router+7.0.2.patch</code></summary>

```diff
diff --git a/node_modules/react-router/dist/development/lib/types/route-module.d.mts b/node_modules/react-router/dist/development/lib/types/route-module.d.mts
index c455306..762fd83 100644
--- a/node_modules/react-router/dist/development/lib/types/route-module.d.mts
+++ b/node_modules/react-router/dist/development/lib/types/route-module.d.mts
@@ -1,7 +1,9 @@
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.mjs';
import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
import 'react';
-
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
type RouteModule = {
meta?: Func;
diff --git a/node_modules/react-router/dist/development/lib/types/route-module.d.ts b/node_modules/react-router/dist/development/lib/types/route-module.d.ts
index a7b3449..776fdbc 100644
--- a/node_modules/react-router/dist/development/lib/types/route-module.d.ts
+++ b/node_modules/react-router/dist/development/lib/types/route-module.d.ts
@@ -1,7 +1,9 @@
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.js';
import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
import 'react';
-
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
type RouteModule = {
meta?: Func;
diff --git a/node_modules/react-router/dist/development/route-data-DuV3tXo2.d.mts b/node_modules/react-router/dist/development/route-data-DuV3tXo2.d.mts
index 53dbfb3..d33adfc 100644
--- a/node_modules/react-router/dist/development/route-data-DuV3tXo2.d.mts
+++ b/node_modules/react-router/dist/development/route-data-DuV3tXo2.d.mts
@@ -1531,8 +1531,10 @@ type Func = (...args: any[]) => unknown;
type Pretty<T> = {
[K in keyof T]: T[K];
} & {};
-
-type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
+type Serialize<T> = T extends SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
[K in keyof T]: Serialize<T[K]>;
} : undefined;
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
diff --git a/node_modules/react-router/dist/development/route-data-DuV3tXo2.d.ts b/node_modules/react-router/dist/development/route-data-DuV3tXo2.d.ts
index 53dbfb3..d33adfc 100644
--- a/node_modules/react-router/dist/development/route-data-DuV3tXo2.d.ts
+++ b/node_modules/react-router/dist/development/route-data-DuV3tXo2.d.ts
@@ -1531,8 +1531,10 @@ type Func = (...args: any[]) => unknown;
type Pretty<T> = {
[K in keyof T]: T[K];
} & {};
-
-type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
+type Serialize<T> = T extends SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
[K in keyof T]: Serialize<T[K]>;
} : undefined;
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
diff --git a/node_modules/react-router/dist/production/lib/types/route-module.d.mts b/node_modules/react-router/dist/production/lib/types/route-module.d.mts
index c455306..762fd83 100644
--- a/node_modules/react-router/dist/production/lib/types/route-module.d.mts
+++ b/node_modules/react-router/dist/production/lib/types/route-module.d.mts
@@ -1,7 +1,9 @@
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.mjs';
import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
import 'react';
-
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
type RouteModule = {
meta?: Func;
diff --git a/node_modules/react-router/dist/production/lib/types/route-module.d.ts b/node_modules/react-router/dist/production/lib/types/route-module.d.ts
index a7b3449..776fdbc 100644
--- a/node_modules/react-router/dist/production/lib/types/route-module.d.ts
+++ b/node_modules/react-router/dist/production/lib/types/route-module.d.ts
@@ -1,7 +1,9 @@
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.js';
import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
import 'react';
-
+export type SerializesTo<T> = {
+ $__RR_SerializesTo?: [T];
+ };
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
type RouteModule = {
meta?: Func;

```

</details>

## Usage

### Using `apolloLoader` with `useReadQuery`
Expand Down
4 changes: 2 additions & 2 deletions packages/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"publint": "0.2.7",
"react": "^19.0.0",
"react-dom": "*",
"react-router": "^7.1.5",
"react-router": "^7.2.0-pre.3",
"rimraf": "5.0.5",
"tsup": "8.0.2",
"typescript": "5.4.5",
Expand All @@ -88,7 +88,7 @@
"peerDependencies": {
"@apollo/client": "^3.13.0",
"react": "^19",
"react-router": "^7.0.2"
"react-router": "^7.2.0-pre.3"
},
"dependencies": {
"@apollo/client-react-streaming": "0.12.0-alpha.0",
Expand Down
5 changes: 2 additions & 3 deletions packages/react-router/src/preloader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ import {
} from "@apollo/client-react-streaming";
import type { Promiscade } from "promiscade";
import { promiscadeToReadableStream, streamToPromiscade } from "promiscade";
// still requires a patch, waiting for https://github.com/remix-run/react-router/pull/12264
import type { SerializesTo } from "react-router/route-module";
import type { unstable_SerializesTo } from "react-router";
import type { JsonString } from "@apollo/client-react-streaming/stream-utils";

type MarkedForSerialization<T> =
T extends TransportedQueryRef<infer Data, infer Variables>
? SerializesTo<QueryRef<Data, Variables>>
? unstable_SerializesTo<QueryRef<Data, Variables>>
: { [K in keyof T]: MarkedForSerialization<T[K]> };

type ApolloLoader = <LoaderArgs extends CreateServerLoaderArgs<any>>() => <
Expand Down
Loading

0 comments on commit 2f4890a

Please sign in to comment.