From c5833c97adc7b0aa45d684da4b2507ba9c831c94 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 15 May 2023 11:52:14 -0700 Subject: [PATCH] single-item: prevent circular refs Signed-off-by: Varun Patil --- src/services/dav/single-item.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/services/dav/single-item.ts b/src/services/dav/single-item.ts index 957b3657..569ef257 100644 --- a/src/services/dav/single-item.ts +++ b/src/services/dav/single-item.ts @@ -13,16 +13,18 @@ export function isSingleItem(): boolean { } export async function getSingleItemData(): Promise { - if (!singleItem?.fileid) { - return []; - } + if (!singleItem?.fileid) return []; + // Make days array singleItem.key = singleItem.fileid; - return [ + const days = [ { dayid: singleItem.dayid, count: 1, detail: [singleItem], }, - ] as any[]; + ]; + + // Return copy to prevent circular reference + return JSON.parse(JSON.stringify(days)); }