Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

442
Vistas
Refreshing a vue component from a vue-router route

I have a view in my SPA that is loaded via vue router when a user types in a id in my sidebar. The component loads up and the prop is passed correctly through the route but if I type into the sidebar another id to load up I get this in console:

"vue-router.min.js:11 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/mainreview/search?id=1560".

My search functionality is using push() from a axios request to confirm that id exists and returns that as an array then pushes the component:

router.push({ path: '/mainreview/search', query: { mmcid: this.id[0].ID } });

My route is as follows:

 { path: '/mainreview/search', component: mainreview, props: route => ({ id: route.query.id })}

Most posts I have found on here seem to recommend suppressing the error but in my case I want it to reload the component so that the mount function inside the component runs again which is what triggers my an axios call with all my data.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you only need an id and no other query param is needed, why don't just use it as url param?

{ 
    path: '/mainreview/search/:id', 
    component: mainreview, 
    props: true
}

Then you can push

router.push({ path: '/mainreview/search', params: { id: this.id[0].ID } });
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda