diff --git a/dashboard/src/components/DataLoader.js b/dashboard/src/components/DataLoader.js index b3a3b2d241..be1bfb5884 100644 --- a/dashboard/src/components/DataLoader.js +++ b/dashboard/src/components/DataLoader.js @@ -468,8 +468,11 @@ export function useDataLoader(options = { refreshOnMount: false }) { } export const mergeItems = (oldItems, newItems = []) => { - const newItemsIds = newItems?.map((i) => i._id) || []; - const oldItemsPurged = oldItems.filter((i) => !newItemsIds.includes(i._id)); + const newItemIds = {}; + for (const newItem of newItems) { + newItemIds[newItem._id] = true; + } + const oldItemsPurged = oldItems.filter((i) => !newItemIds[i._id]); return [...oldItemsPurged, ...newItems].filter((e) => !e.deletedAt); };