Skip to content

Parameters for parent route added to query instead #647

@RomkeVdMeulen

Description

@RomkeVdMeulen

I'm submitting a bug report

  • Library Version:
    1.7.1

Current behavior:
In a child route, when generating the URL of a parent route with parameters, if I explicitly pass in one of those parameters, it is added to the query string in stead of being in the path itself.

E.g.: I'm in #/user/1/preferences/edit and I call: router.generate("userprefs", {id: 1}) I get: #/user/1/preferences?id=1

Even worse, if I call router.generate("userprefs", {id: 2}) I get #/user/1/preferences?id=2.

If I call router.generate("userprefs") I get the expected URL of #/user/1/preferences, which is good.

  • What is the expected behavior?
    Parameters that match path parameters should be used in that path and not be added to the query string.

See https://gist.run/?id=79ddeec65d8da990005115c73db970b1 for a simple reproduction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions