]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: docs
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 29 Aug 2025 13:55:39 +0000 (15:55 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 29 Aug 2025 13:55:39 +0000 (15:55 +0200)
packages/router/src/experimental/route-resolver/matchers/matcher-pattern-query.ts

index 559b679530ffd6a94b16bae370fb04ed8e6e74af..a5a09b6b00e96d6aa604f01dc26f4091c9449efe 100644 (file)
@@ -60,16 +60,19 @@ export class MatcherPatternQueryParam<T, ParamName extends string>
             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<T, ParamName extends string>
     }
 
     // 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()