]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix: adapt route ranking
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 26 Sep 2019 16:11:02 +0000 (18:11 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 26 Sep 2019 16:11:12 +0000 (18:11 +0200)
src/matcher.ts

index 7fe9998f28a12821fb4e59d717ca5ac666585d3a..a283776cf62f4ebe3655adbd40794008fe515b4d 100644 (file)
@@ -57,13 +57,20 @@ const enum PathScore {
   Wildcard = -1 * _multiplier, // /:namedWildcard(.*)
   SubWildcard = 1 * _multiplier, // Wildcard as a subsegment
   Repeatable = -0.5 * _multiplier, // /:w+ or /:w*
-  Strict = 0.7 * _multiplier, // when options strict: true is passed, as the regex omits \/?
-  CaseSensitive = 0.25 * _multiplier, // when options strict: true is passed, as the regex omits \/?
+  // these two have to be under 0.1 so a strict /:page is still lower than /:a-:b
+  Strict = 0.07 * _multiplier, // when options strict: true is passed, as the regex omits \/?
+  CaseSensitive = 0.025 * _multiplier, // when options strict: true is passed, as the regex omits \/?
   Optional = -4 * _multiplier, // /:w? or /:w*
   SubOptional = -0.1 * _multiplier, // optional inside a subsegment /a-:w? or /a-:w*
   Root = 1 * _multiplier, // just /
 }
 
+/**
+ * Non Working Rankings:
+ * - ?p=AAOsIPQgYAEL9lNgQAGKBeACgQMODLpiY5C0gAQYhGyZkaNyaRFZOwOOkPODO_HsENkAAA..
+ *  the case sensitive and the strict option on the optional parameter `/:a-:w?` or `/:a?-:w` will come before `/:a-b`
+ */
+
 // allows to check if the user provided a custom regexp
 const isDefaultPathRegExpRE = /^\[\^[^\]]+\]\+\?$/