Tag Archives: VueUncaught error

VueUncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “/

Errors caused by repeated triggering of vue router routing

VueUncaught ( in promise) NavigationDuplicated: Avoided redundant navigation to current location: " /

 or

vue Uncaught Error: Redirected when going from “/*“ to “/*“
Don't talk nonsense

method 1:

This solution can be possible, but method 2 feels better

 this .$router.replace({
        path: this .$route.path,
        query
   })
 . catch (()=>()); // throw error

Method 2:

It is recommended to take a closer look at the discussion plan on github that is very detailed   https://github.com/vuejs/vue-router/issues/2881

// Initialize the injection routing place 
import Vue from'vue' 
import Router from'vue-router'

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location, onResolve, onReject) {
     if (onResolve || onReject) return originalPush.call( this , location, onResolve, onReject);
     return originalPush.call( this , location). catch (err => err);
};

Vue.use(Router)

...
const router = new Router({
  routes
})

...