From: Eduardo San Martin Morote Date: Fri, 29 Aug 2025 13:55:39 +0000 (+0200) Subject: chore: docs X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ecbbcd9d7ae62bdf6e0dc7b542046b1923302dfc;p=thirdparty%2Fvuejs%2Frouter.git chore: docs --- diff --git a/packages/router/src/experimental/route-resolver/matchers/matcher-pattern-query.ts b/packages/router/src/experimental/route-resolver/matchers/matcher-pattern-query.ts index 559b6795..a5a09b6b 100644 --- a/packages/router/src/experimental/route-resolver/matchers/matcher-pattern-query.ts +++ b/packages/router/src/experimental/route-resolver/matchers/matcher-pattern-query.ts @@ -60,16 +60,19 @@ export class MatcherPatternQueryParam valueBeforeParse ) as T } catch (error) { + // if there is a miss but we have a default, use it + // otherwise rethrow the error if (this.defaultValue === undefined) { throw error } + // ensure the default value is used value = undefined } } } else { try { value = - // non existing query param should falll back to defaultValue + // non existing query param should fall back to defaultValue valueBeforeParse === undefined ? valueBeforeParse : ((this.parser.get ?? PARAM_PARSER_DEFAULTS.get)( @@ -83,6 +86,8 @@ export class MatcherPatternQueryParam } // miss if there is no default and there was no value in the query + // otherwise, use the default value. This allows parsers to return undefined + // when they want to possibly fallback to the default value if (value === undefined) { if (this.defaultValue === undefined) { throw miss()