From 32706150e007ee62f27a720f9084cac5a6afa365 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 21 Nov 2022 11:52:41 +0100 Subject: [PATCH] Fix changing event uuid didn't change event data Closes #1192 Signed-off-by: Thomas Citharel --- js/src/composition/apollo/event.ts | 7 ++++--- js/src/views/Event/EventView.vue | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/js/src/composition/apollo/event.ts b/js/src/composition/apollo/event.ts index cbd156271..bc5a827a9 100644 --- a/js/src/composition/apollo/event.ts +++ b/js/src/composition/apollo/event.ts @@ -10,11 +10,12 @@ export function useFetchEvent(uuid?: string) { error, onError, onResult, + refetch, } = useQuery<{ event: IEvent }>( FETCH_EVENT, - { + () => ({ uuid, - }, + }), () => ({ enabled: uuid !== undefined, }) @@ -22,7 +23,7 @@ export function useFetchEvent(uuid?: string) { const event = computed(() => fetchEventResult.value?.event); - return { event, loading, error, onError, onResult }; + return { event, loading, error, onError, onResult, refetch }; } export function useFetchEventBasic(uuid: string) { diff --git a/js/src/views/Event/EventView.vue b/js/src/views/Event/EventView.vue index 6a0763a8c..c65e1b852 100755 --- a/js/src/views/Event/EventView.vue +++ b/js/src/views/Event/EventView.vue @@ -298,11 +298,19 @@ const props = defineProps<{ const { t } = useI18n({ useScope: "global" }); +const propsUUID = computed(() => props.uuid) + const { event, onError: onFetchEventError, loading: eventLoading, + refetch: refetchEvent, } = useFetchEvent(props.uuid); + +watch(propsUUID, (newUUid) => { + refetchEvent({ uuid: newUUid }) +}) + const eventId = computed(() => event.value?.id); const { currentActor } = useCurrentActorClient(); const currentActorId = computed(() => currentActor.value?.id);