Allow multiple push with different state within the same path #2294
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.