fix: do not add duplicates to threads (#944)

attempt to fix #943
This commit is contained in:
Nolan Lawson 2019-02-06 11:36:46 -08:00 committed by GitHub
parent 10b14abcdb
commit 6e0f2ef6bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,7 +147,11 @@ export async function showMoreItemsForThread (instanceName, timelineName) {
let itemIdsToAdd = store.getForTimeline(instanceName, timelineName, 'itemIdsToAdd') let itemIdsToAdd = store.getForTimeline(instanceName, timelineName, 'itemIdsToAdd')
let timelineItemIds = store.getForTimeline(instanceName, timelineName, 'timelineItemIds') let timelineItemIds = store.getForTimeline(instanceName, timelineName, 'timelineItemIds')
// TODO: update database and do the thread merge correctly // 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, { store.setForTimeline(instanceName, timelineName, {
itemIdsToAdd: [], itemIdsToAdd: [],
timelineItemIds: timelineItemIds timelineItemIds: timelineItemIds