Skip to content

matchPath with named parameter wrongly acting like catch-all #27152

Answered by pieh
lucis asked this question in Help
Discussion options

You must be logged in to vote

The path ranking algorithm we use is pretty much copy of reach/router internals ( which are documented in https://reach.tech/router/ranking ).

Using example route you provided it seems like both /:slug and /app/* rank exactly the same with score of 6, which is problematic. In case of same rank we do use alphabetic order (

// if specificity is the same we do lexigraphic comparison of path to ensure
// deterministic order regardless of order pages where created
return a.matchPath.localeCompare(b.matchPath)
) to ensure that output order is deterministic regardless of input order, bu…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by LekoArts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #27152 on October 19, 2020 08:59.