-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Description
What problem does this feature solve?
Using router.replace to update query parameters. However this triggers scrollBehavior and scrolls to the top. As far as I know, there is no way to distinguish between a push and a replace event.
What does the proposed API look like?
Here are some options:
Could be a simple boolean passed to the scrollBehavior function
scrollBehavior (toRoute, fromRoute, savedPosition, isPush) {
It could be put in the route object to be consistent with this suggestion: #1620
scrollBehavior (toRoute, fromRoute, savedPosition) {
const isPush = toRoute.navigationType === 'push';
I could also work with the replace function accepting an additional parameter, or having a new signature, that simply updates the url and router.$route
without going through guards, scrollbehavior etc. I originally just updated the state manually to circumvent this (using history.replaceState), however that caused some other sneaky bugs since vue-router didn't know about these changes.
router.replace(route, true)
// OR
router.replace(route, { noEvents/silent: true })
// OR
router.silentReplace(route)
AlttiRi
Metadata
Metadata
Assignees
Labels
No labels