You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to update the location URL without triggering scrollBehavior.
I need to trigger scrollBehavior only on the page refresh, or when I go to the route from other one to scroll the page to the selected item. (I select an item by a click on it then I add its ID to the location URL).
As you can see in this example, I do not use neither name, or path. I'm still on the same route ("/items/:id?") after using replace. Using of hash (/items#1), or searchParams(/items?id=1) for storing a data on the same route have this issue too.
Or add any way to attach a meta object (for example, {passive: true, foo: "bar"}) to check it in scrollBehavior and guard functions.
A simple if (to.state.passive) { return; } in scrollBehavior will be acceptable option too.
Describe alternatives you've considered
Yeah, I can write a workaround, but I (and not only me) would like to see this simple and expected option from the box.
The text was updated successfully, but these errors were encountered:
What problem is this solving
I want to update the location URL without triggering
scrollBehavior
.I need to trigger
scrollBehavior
only on the page refresh, or when I go to the route from other one to scroll the page to the selected item. (I select an item by a click on it then I add its ID to the location URL).scrollBehavior
on a particular<router-link>
vue-router#2921Proposed solution
Add a
passive
option forrouter.push
/router.replace
to skipscrollBehavior
and guards, for example, if there is no transition to another route.As you can see in this example, I do not use neither
name
, orpath
. I'm still on the same route ("/items/:id?"
) after usingreplace
. Using ofhash
(/items#1
), orsearchParams
(/items?id=1
) for storing a data on the same route have this issue too.Or add any way to attach a meta object (for example,
{passive: true, foo: "bar"}
) to check it inscrollBehavior
and guard functions.A simple
if (to.state.passive) { return; }
inscrollBehavior
will be acceptable option too.Describe alternatives you've considered
Yeah, I can write a workaround, but I (and not only me) would like to see this simple and expected option from the box.
The text was updated successfully, but these errors were encountered: