Skip to content

Commit ecbbcd9

Browse files
committed
chore: docs
1 parent cd0b5fa commit ecbbcd9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/router/src/experimental/route-resolver/matchers/matcher-pattern-query.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,19 @@ export class MatcherPatternQueryParam<T, ParamName extends string>
6060
valueBeforeParse
6161
) as T
6262
} catch (error) {
63+
// if there is a miss but we have a default, use it
64+
// otherwise rethrow the error
6365
if (this.defaultValue === undefined) {
6466
throw error
6567
}
68+
// ensure the default value is used
6669
value = undefined
6770
}
6871
}
6972
} else {
7073
try {
7174
value =
72-
// non existing query param should falll back to defaultValue
75+
// non existing query param should fall back to defaultValue
7376
valueBeforeParse === undefined
7477
? valueBeforeParse
7578
: ((this.parser.get ?? PARAM_PARSER_DEFAULTS.get)(
@@ -83,6 +86,8 @@ export class MatcherPatternQueryParam<T, ParamName extends string>
8386
}
8487

8588
// miss if there is no default and there was no value in the query
89+
// otherwise, use the default value. This allows parsers to return undefined
90+
// when they want to possibly fallback to the default value
8691
if (value === undefined) {
8792
if (this.defaultValue === undefined) {
8893
throw miss()

0 commit comments

Comments
 (0)