Skip to content

Allow multiple push with different state within the same path #2294

Open
@sjquant

Description

What problem is this solving

Currently, Vue Router prevents pushing the same path multiple times, even if the state differs. This restriction limits the ability to manage state changes effectively within the same route. I propose an enhancement to allow multiple pushes to the same path if the state is different.
me.

Benefits

  • Enhanced state management within the same route.
  • Improved user experience by enabling dynamic updates without altering the URL.
  • Greater flexibility for developers to manage state-specific rendering.

Providing this feature will align Vue Router with modern state management practices and enhance its capabilities in dynamic applications.

Thank you for considering this enhancement. I look forward to your feedback and any further discussion on this proposal.

Proposed solution

Implement a check within the push method to determine if the state has changed. If the state is different, allow the push to proceed even if the path is the same. (maybe check state change in isSameRouteLocation)

Describe alternatives you've considered

As a temporary workaround, we can append a query parameter to the path, but this approach clutters the URL, and there are times when changing URL is not ideal.

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthas workaroundA workaround has been found to deal with the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions