Skip to content

Ordered url params #4262

@bleucitron

Description

@bleucitron

Describe the problem

It's currently impossible to have information about the order of url params.

Say i have the following path: /anything/${id}/${otherId}, and i want to display in a breadcrumbs component content related to each id and otherId (for instance a name, fetched from a distant api).

$page.params gives {id, otherId}, which can be used to get a reverse mapping between the slug values in the path and the name of each param, helpful to know what to do with each value (basically fetch data).
But what if id and otherId actually are the same value, 1 for instance ? In this case, the reversing mapping would be broken, since we'd get {1: 'otherId'}, and lose the info about id.

Describe the proposed solution

Maybe make an orderedParams available in InputProps and page store.

It would provide [{slug: 'id', value: 1}, {slug: 'otherId', value: 1}], or even just ['id', 'otherId'].

Alternatives considered

Hope all the ids are unique.

Importance

nice to have

Additional Information

No response

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