Skip to content

Children explicit path are not preferred more than path with route parameters #17

@whs

Description

@whs

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/:username
  • github.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions