From 948c0134f66b97b9d2e6ef72ccef20798f149e3d Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Fri, 9 Feb 2024 14:59:56 -0600 Subject: [PATCH] [23.0] Fix `datasetStore.saveDatasets` bug When we update the datasets in the `datasetStore`, we can sometimes set multiple properties to undefined. This happens because a dataset in the store fetched from `/api/datasets/${id}` has a keys mismatch from a dataset coming from `/api/histories/${historyId}/contents` in `watchHistory`, where the latter has lesser keys. To address this, I replaced 'localItem' with 'item' in the loop that updates the keys, ensuring the correct properties are retained during the store update. --- client/src/store/historyStore/datasetStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/store/historyStore/datasetStore.js b/client/src/store/historyStore/datasetStore.js index d044c33aac1f..5df5072179a7 100644 --- a/client/src/store/historyStore/datasetStore.js +++ b/client/src/store/historyStore/datasetStore.js @@ -41,7 +41,7 @@ const mutations = { const id = item.id; if (state.items[id]) { const localItem = state.items[id]; - Object.keys(localItem).forEach((key) => { + Object.keys(item).forEach((key) => { localItem[key] = item[key]; }); }