Skip to content

Commit 16825f3

Browse files
committed
fix: align state validation with search validation behavior
1 parent fe9d1dc commit 16825f3

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

packages/router-core/src/router.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,19 +1208,16 @@ export class RouterCore<
12081208
const filteredState = rawState ? omitInternalKeys(rawState) : {}
12091209

12101210
try {
1211-
if (route.options.validateState) {
1212-
const strictState =
1213-
validateState(route.options.validateState, filteredState) || {}
1214-
return [
1215-
{
1216-
...filteredState,
1217-
...strictState,
1218-
},
1219-
{ ...parentStrictState, ...strictState },
1220-
undefined,
1221-
]
1222-
}
1223-
return [filteredState, {}, undefined]
1211+
const strictState =
1212+
validateState(route.options.validateState, filteredState) || {}
1213+
return [
1214+
{
1215+
...filteredState,
1216+
...strictState,
1217+
},
1218+
{ ...parentStrictState, ...strictState },
1219+
undefined,
1220+
]
12241221
} catch (err: any) {
12251222
const stateValidationError = err
12261223

0 commit comments

Comments
 (0)