abstract-state-router icon indicating copy to clipboard operation
abstract-state-router copied to clipboard

It is possible for `makePath` to return a url that will not be matched by the router

Open TehShrike opened this issue 4 years ago • 0 comments
trafficstars

Discovered by @Vehmloewff

If you have a parent state with a route parent and a default child state that has an empty string as its route, makePath will return a route /parent but the router will only be listening for a route with a trailing slash /parent/.

Should probably start with a unit test asserting that the output of both those functions match each other.

I'm just guessing, but the best fix might be to change page-path-builder (used in makePath only) to not add a trailing slash when there are empty chunks like that.

Or maybe the root issue is with the arguments being passed to makePath

TehShrike avatar Nov 20 '20 18:11 TehShrike