From 33dfeea1685aa05c279fe42755c1d9f039240f2e Mon Sep 17 00:00:00 2001 From: wvffle Date: Thu, 30 Jun 2022 03:20:34 +0000 Subject: [PATCH] Fix router navigation --- front/src/composables/useOrdering.ts | 7 +++++-- front/src/router/index.ts | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/front/src/composables/useOrdering.ts b/front/src/composables/useOrdering.ts index e275825a9..754311499 100644 --- a/front/src/composables/useOrdering.ts +++ b/front/src/composables/useOrdering.ts @@ -14,7 +14,7 @@ export default (orderingConfigName: MaybeRef) => { const config = reactiveComputed(() => { const name = unref(orderingConfigName) ?? route.name as RouteWithPreferences - return store.state.ui.routePreferences[name] + return { ...store.state.ui.routePreferences[name] } }) const { paginateBy, ordering, orderingDirection } = toRefs(config) @@ -29,7 +29,10 @@ export default (orderingConfigName: MaybeRef) => { field: (str[0] === '-' || str[0] === '+' ? str.slice(1) : str) as OrderingField }) - const onOrderingUpdate = (fn: () => void) => watch(config, fn) + const onOrderingUpdate = (fn: () => void) => { + const stop = watch(config, fn) + return stop + } return { paginateBy, diff --git a/front/src/router/index.ts b/front/src/router/index.ts index d13480252..9ed669f44 100644 --- a/front/src/router/index.ts +++ b/front/src/router/index.ts @@ -673,9 +673,7 @@ export default createRouter({ path: 'podcasts/', name: 'library.podcasts.browse', component: () => - import( - '~/components/library/Podcasts.vue' - ), + import('~/components/library/Podcasts.vue'), props: route => ({ defaultOrdering: route.query.ordering, defaultQuery: route.query.query,