Skip to content

Commit 159ae96

Browse files
committed
feat: Key isolation for React Router & Remix
1 parent 211fdf9 commit 159ae96

File tree

14 files changed

+134
-52
lines changed

14 files changed

+134
-52
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
@@ -41,6 +41,8 @@ const router = createBrowserRouter(
4141
<Route path="form/useQueryStates" lazy={load(import('./routes/form.useQueryStates'))} />
4242
<Route path="referential-stability/useQueryState" lazy={load(import('./routes/referential-stability.useQueryState'))} />
4343
<Route path="referential-stability/useQueryStates" lazy={load(import('./routes/referential-stability.useQueryStates'))} />
44+
<Route path="key-isolation/useQueryState" lazy={load(import('./routes/key-isolation.useQueryState'))} />
45+
<Route path="key-isolation/useQueryStates" lazy={load(import('./routes/key-isolation.useQueryStates'))} />
4446

4547
<Route path="render-count/:hook/:shallow/:history/:startTransition/no-loader" lazy={load(import('./routes/render-count.$hook.$shallow.$history.$startTransition.no-loader'))} />
4648
<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
@@ -24,6 +24,8 @@ export default [
2424
route('/form/useQueryStates', './routes/form.useQueryStates.tsx'),
2525
route('/referential-stability/useQueryState', './routes/referential-stability.useQueryState.tsx'),
2626
route('/referential-stability/useQueryStates', './routes/referential-stability.useQueryStates.tsx'),
27+
route('/key-isolation/useQueryState', './routes/key-isolation.useQueryState.tsx'),
28+
route('/key-isolation/useQueryStates', './routes/key-isolation.useQueryStates.tsx'),
2729
route('/render-count/:hook/:shallow/:history/:startTransition/no-loader', './routes/render-count.$hook.$shallow.$history.$startTransition.no-loader.tsx'),
2830
route('/render-count/:hook/:shallow/:history/:startTransition/sync-loader', './routes/render-count.$hook.$shallow.$history.$startTransition.sync-loader.tsx'),
2931
route('/render-count/:hook/:shallow/:history/:startTransition/async-loader', './routes/render-count.$hook.$shallow.$history.$startTransition.async-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)