Children explicit path are not preferred more than path with route parameters
whs opened this issue · comments
The issue can be demonstrated by this test:
it('should prefer explicit path', ( ) => {
const node = new RouteNode('', '', [
new RouteNode('a', '/a', [
new RouteNode('b', 'b'),
]),
new RouteNode('c', '/:a/:b'),
]);
withoutMeta(node.matchPath('/a/b')).should.eql({ name: 'b', params: { } });
});
For example, this use case will be failing
github.com/:username/:repo
is matched by a node directly from root as it has no dependency on github.com/:usernamegithub.com/settings/profile
is matched by a node under /settings as /settings will handle the sidebar rendering.
If this routing is done by router5, /settings/profile
will be matched to the /:username/:repo
route.