You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(router-core): processRouteTree orders routes w/ prefix / suffix based on their lengths (#4850)
When ordering routes to determine "which one will match in priority", we
try to follow the "more specific 1st" principle.
Currently, 2 routes with the same pattern, but with prefixes of
different lengths, are counted as having the same specificity, and thus
are not re-ordered. For example:
- `/f{$param}`
- `/foo{$param}`
In this case, assuming `f{$param}.tsx` is returned 1st by the OS when
listing route files (which it is by alphabetical order), a path
`/foobar` will match `/f{$param}`.
This PR proposes we take the `length` of the `prefix` and `suffix` into
account when sorting routes. In this example this would mean
`/foo{$param}` takes priority because it is considered more specific.
0 commit comments