Skip to content

Commit 3329f5c

Browse files
committed
feat: Key isolation for React Router & Remix
1 parent 3b89061 commit 3329f5c

File tree

14 files changed

+140
-58
lines changed

14 files changed

+140
-58
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { testKeyIsolation } from 'e2e-shared/specs/key-isolation.cy'
2+
3+
testKeyIsolation({
4+
path: '/key-isolation/useQueryState',
5+
hook: 'useQueryState'
6+
})
7+
8+
testKeyIsolation({
9+
path: '/key-isolation/useQueryStates',
10+
hook: 'useQueryStates'
11+
})

packages/e2e/react-router/v6/src/react-router.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const router = createBrowserRouter(
4545
<Route path="fog-of-war/result" lazy={load(import('./routes/fog-of-war.result'))} />
4646
<Route path="conditional-rendering/useQueryState" lazy={load(import('./routes/conditional-rendering.useQueryState'))} />
4747
<Route path="conditional-rendering/useQueryStates" lazy={load(import('./routes/conditional-rendering.useQueryStates'))} />
48+
<Route path="key-isolation/useQueryState" lazy={load(import('./routes/key-isolation.useQueryState'))} />
49+
<Route path="key-isolation/useQueryStates" lazy={load(import('./routes/key-isolation.useQueryStates'))} />
4850

4951
<Route path="render-count/:hook/:shallow/:history/:startTransition/no-loader" lazy={load(import('./routes/render-count.$hook.$shallow.$history.$startTransition.no-loader'))} />
5052
<Route path="render-count/:hook/:shallow/:history/:startTransition/sync-loader" lazy={load(import('./routes/render-count.$hook.$shallow.$history.$startTransition.sync-loader'))} />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { KeyIsolationUseQueryState } from 'e2e-shared/specs/key-isolation'
2+
3+
export default KeyIsolationUseQueryState
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { KeyIsolationUseQueryStates } from 'e2e-shared/specs/key-isolation'
2+
3+
export default KeyIsolationUseQueryStates

packages/e2e/react-router/v7/app/routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export default [
2828
route('/fog-of-war/result', './routes/fog-of-war.result.tsx'),
2929
route('/conditional-rendering/useQueryState', './routes/conditional-rendering.useQueryState.tsx'),
3030
route('/conditional-rendering/useQueryStates', './routes/conditional-rendering.useQueryStates.tsx'),
31+
route('/key-isolation/useQueryState', './routes/key-isolation.useQueryState.tsx'),
32+
route('/key-isolation/useQueryStates', './routes/key-isolation.useQueryStates.tsx'),
3133

3234
route('/render-count/:hook/:shallow/:history/:startTransition/no-loader', './routes/render-count.$hook.$shallow.$history.$startTransition.no-loader.tsx'),
3335
route('/render-count/:hook/:shallow/:history/:startTransition/sync-loader', './routes/render-count.$hook.$shallow.$history.$startTransition.sync-loader.tsx'),
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { KeyIsolationUseQueryState } from 'e2e-shared/specs/key-isolation'
2+
3+
export default KeyIsolationUseQueryState
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { KeyIsolationUseQueryStates } from 'e2e-shared/specs/key-isolation'
2+
3+
export default KeyIsolationUseQueryStates
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { testKeyIsolation } from 'e2e-shared/specs/key-isolation.cy'
2+
3+
testKeyIsolation({
4+
path: '/key-isolation/useQueryState',
5+
hook: 'useQueryState'
6+
})
7+
8+
testKeyIsolation({
9+
path: '/key-isolation/useQueryStates',
10+
hook: 'useQueryStates'
11+
})
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { KeyIsolationUseQueryState } from 'e2e-shared/specs/key-isolation'
2+
3+
const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
4+
5+
export async function loader() {
6+
await wait(100)
7+
return null
8+
}
9+
10+
export default KeyIsolationUseQueryState
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { KeyIsolationUseQueryStates } from 'e2e-shared/specs/key-isolation'
2+
3+
export default KeyIsolationUseQueryStates

0 commit comments

Comments
 (0)