about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-12-13 15:35:11 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-12-13 15:35:11 -0600
commitac976672069e8b5e0cede6591dcf7ce8b9795219 (patch)
treedf15a36736daf66de138787fa689ccde68b1fb93 /src
parent8af8d782c71de90a719e661abe6bc496b8f27be5 (diff)
downloadvoidsky-ac976672069e8b5e0cede6591dcf7ce8b9795219.tar.zst
Fix: avoid duplicate key names in notifications
Diffstat (limited to 'src')
-rw-r--r--src/state/models/notifications-view.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/state/models/notifications-view.ts b/src/state/models/notifications-view.ts
index cc8952512..fec646b9a 100644
--- a/src/state/models/notifications-view.ts
+++ b/src/state/models/notifications-view.ts
@@ -11,6 +11,8 @@ const UNGROUPABLE_REASONS = ['trend', 'assertion']
 const PAGE_SIZE = 30
 const MS_60MIN = 1e3 * 60 * 60
 
+let _idCounter = 0
+
 export interface GroupedNotification extends ListNotifications.Notification {
   additional?: ListNotifications.Notification[]
 }
@@ -361,13 +363,12 @@ export class NotificationsViewModel {
   private async _appendAll(res: ListNotifications.Response, replace = false) {
     this.loadMoreCursor = res.data.cursor
     this.hasMore = !!this.loadMoreCursor
-    let counter = this.notifications.length
     const promises = []
     const itemModels: NotificationsViewItemModel[] = []
     for (const item of groupNotifications(res.data.notifications)) {
       const itemModel = new NotificationsViewItemModel(
         this.rootStore,
-        `item-${counter++}`,
+        `item-${_idCounter++}`,
         item,
       )
       if (itemModel.needsAdditionalData) {