Skip to content

Commit 4ddec20

Browse files
committed
fix: update useBlocker behavior and eslint config for 404 page handling
1 parent d69dadb commit 4ddec20

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

packages/react-router/eslint.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default [
1919
'@eslint-react/dom/no-missing-button-type': 'off',
2020
'react-hooks/exhaustive-deps': 'error',
2121
'react-hooks/rules-of-hooks': 'error',
22+
'@typescript-eslint/no-unnecessary-condition': 'off',
2223
},
2324
},
2425
]

packages/react-router/src/useBlocker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export function useBlocker(
185185
routeId: '__notFound__',
186186
fullPath: pathname,
187187
pathname: pathname,
188-
params: matchedRoutes.routeParams || {},
188+
params: matchedRoutes.routeParams,
189189
search: router.options.parseSearch(location.search),
190190
}
191191
}

packages/react-router/tests/useBlocker.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ describe('useBlocker', () => {
444444

445445
test('should allow navigation from 404 page when blocker is active', async () => {
446446
const rootRoute = createRootRoute({
447-
notFoundComponent: () => {
447+
notFoundComponent: function NotFoundComponent() {
448448
const navigate = useNavigate()
449449

450450
useBlocker({ shouldBlockFn: () => true })
@@ -512,7 +512,7 @@ describe('useBlocker', () => {
512512

513513
test('should handle blocker navigation from 404 to another 404', async () => {
514514
const rootRoute = createRootRoute({
515-
notFoundComponent: () => {
515+
notFoundComponent: function NotFoundComponent() {
516516
const navigate = useNavigate()
517517

518518
useBlocker({ shouldBlockFn: () => true })

0 commit comments

Comments
 (0)