From 3355c297b12bc79d301af32f235623a3da27eff5 Mon Sep 17 00:00:00 2001 From: Nikolay Akhmetov Date: Thu, 31 Oct 2024 12:57:02 -0400 Subject: [PATCH] CAT-974 Fix parent UUID handling for multi-vitessce conf datasets --- CHANGELOG-cat-974.md | 1 + context/app/static/js/pages/Dataset/hooks.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG-cat-974.md diff --git a/CHANGELOG-cat-974.md b/CHANGELOG-cat-974.md new file mode 100644 index 0000000000..aab4faa309 --- /dev/null +++ b/CHANGELOG-cat-974.md @@ -0,0 +1 @@ +- Fix parent UUID handling for multi-vitessce conf datasets. diff --git a/context/app/static/js/pages/Dataset/hooks.ts b/context/app/static/js/pages/Dataset/hooks.ts index d95dcfbda1..ea502943c9 100644 --- a/context/app/static/js/pages/Dataset/hooks.ts +++ b/context/app/static/js/pages/Dataset/hooks.ts @@ -72,10 +72,13 @@ export function useVitessceConf(uuid: string, parentUuid?: string) { if (parentUuid) { urlParams.set('parent', parentUuid); } - const swr = useSWR(getVitessceConfKey(uuid, groupsToken), (_key: unknown) => + const swr = useSWR(getVitessceConfKey(uuid, groupsToken), (_key: unknown) => fetcher({ url: `${base}?${urlParams.toString()}`, requestInit: { headers: getAuthHeader(groupsToken) } }), ); if (parentUuid) { + if (Array.isArray(swr.data)) { + return { ...swr, data: swr.data.map((conf) => ({ ...conf, parentUuid }) as VitessceConf) }; + } return { ...swr, data: { ...swr.data, parentUuid } }; } return swr;