-1

I have a route in vue-router: /items?page=1&rowsPerPage=25&sortBy=state&sortType=desc

every Time i change one of the params (sortBy or page=2) i want to stay on the same site, without reloading the components i include. Currently everytime i update router.replace({ ...router.currentRoute, query: params }) the page is reloaded.

How to avoid this? Is there any good pattern for this data-table use case?

Gooze
  • 73
  • 1
  • 10
  • 2
    The router should not behave this way, and it doesn't when I try it out. It is actually the other way round, you have to explicitly tell it to trigger a reload if you don't change the location (see [`force`](https://router.vuejs.org/api/interfaces/RouteLocationOptions.html#Properties-force)). Is there a sandbox I (or someone else) could look at? – Moritz Ringler May 24 '23 at 10:57
  • probably the problem is me using a layout pattern from https://markus.oberlehner.net/blog/dynamic-vue-layout-components/ where i have router-view inside a router-view.... – Gooze Jun 02 '23 at 11:25

1 Answers1

0

Have you tried calling router.push() instead of router.replace()? It's been a while since I've worked with vue-router, but I've never used replace before. It could be that that solves it for you.

Worth giving a try.

Milo
  • 34
  • 4