Push new query variable to vue router

I’m trying to change just the query string for the current page (not any part of the path). Use case is a paginated table (trying to update the page variable in the url query string).

My attempt to update via vue router

const currentQueries = qs.parse(window.location.search.replace(/^\?/, ''))
currentQueries.page = newPage

the query variable page IS updated in the $route variable in Vue but it is NOT changed in the url in the browser. And further I am receiving this error in the console: NavigationDuplicated: Avoided redundant navigation to current location

What am I doing wrong?


Try: this.$router.push({query:currentQueries}).catch(e => {});

I tried to recreate the problem described in the original post but couldn’t.

I see that error only if I try to set the page to the same value it already has.

What version of Vue are you using? What version of Vue Router? Are you using hash mode or history mode?