From 6d1597637ba6ad74cd57efe8987d2b63636f85b8 Mon Sep 17 00:00:00 2001 From: Kasper Seweryn Date: Thu, 1 Jun 2023 10:14:11 +0200 Subject: [PATCH] fix: dynamically add report targets Part-of: --- front/src/components/manage/library/EditsCardList.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/front/src/components/manage/library/EditsCardList.vue b/front/src/components/manage/library/EditsCardList.vue index 6864795ba..d6a56ad2a 100644 --- a/front/src/components/manage/library/EditsCardList.vue +++ b/front/src/components/manage/library/EditsCardList.vue @@ -61,9 +61,7 @@ interface TargetType { } type Targets = Exclude['type'] -const targets = reactive({ - track: {} -}) as Record> +const targets = reactive>>(Object.create(null)) const fetchTargets = async () => { // we request target data via the API so we can display previous state @@ -96,6 +94,7 @@ const fetchTargets = async () => { }) for (const payload of response?.data?.results ?? []) { + targets[key as keyof typeof targets] ??= Object.create(null) targets[key as keyof typeof targets][payload.id] = { payload, currentState: configs[key as keyof typeof targets].fields.reduce((state, field) => {