From 6e0f2ef6bb9c390b6b1dc92c827c214aeb530b0c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Wed, 6 Feb 2019 11:36:46 -0800 Subject: [PATCH] fix: do not add duplicates to threads (#944) attempt to fix #943 --- src/routes/_actions/timeline.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/routes/_actions/timeline.js b/src/routes/_actions/timeline.js index 78d3dd9..0e91a4f 100644 --- a/src/routes/_actions/timeline.js +++ b/src/routes/_actions/timeline.js @@ -147,7 +147,11 @@ export async function showMoreItemsForThread (instanceName, timelineName) { let itemIdsToAdd = store.getForTimeline(instanceName, timelineName, 'itemIdsToAdd') let timelineItemIds = store.getForTimeline(instanceName, timelineName, 'timelineItemIds') // TODO: update database and do the thread merge correctly - timelineItemIds = timelineItemIds.concat(itemIdsToAdd) + for (let itemIdToAdd of itemIdsToAdd) { + if (!timelineItemIds.includes(itemIdToAdd)) { + timelineItemIds.push(itemIdToAdd) + } + } store.setForTimeline(instanceName, timelineName, { itemIdsToAdd: [], timelineItemIds: timelineItemIds