From 9015a16d4a5044aa801b90d784f1504ad6b0896d Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sun, 15 Dec 2024 10:57:52 +0100 Subject: [PATCH] bugfixing --- src/lib/components/Table/Table.svelte | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/components/Table/Table.svelte b/src/lib/components/Table/Table.svelte index 1da0bf14..1c3c9f7c 100644 --- a/src/lib/components/Table/Table.svelte +++ b/src/lib/components/Table/Table.svelte @@ -168,9 +168,9 @@ } // Create a new array to store the final data - const updatedRawData = rawData.map((originalItem) => { + const updatedRawData = rawData?.map((originalItem) => { // Find the corresponding item in updateData by matching symbol - const updateItem = updateData.find( + const updateItem = updateData?.find( (item) => item.symbol === originalItem.symbol, ); @@ -185,12 +185,12 @@ // Merge fields from updateData Object.assign(newData, updateItem); - // Apply defaultRules logic defaultRules?.forEach((rule) => { // If the rule is missing in updateData but exists in original data, preserve original - if (!(rule in updateItem) && rule in originalItem) { + if (rule in originalItem) { newData[rule] = originalItem[rule]; } + //!(rule in updateItem) && }); // Explicitly ensure 'rank' and 'years' are preserved if missing in update