From 8473426f81c11f04b3c288446afbde689d38f880 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Tue, 2 May 2023 16:23:35 +0200 Subject: [PATCH] fix(ui): fix events merging --- frontend/app/types/session/session.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/frontend/app/types/session/session.ts b/frontend/app/types/session/session.ts index 239871600..aae250fba 100644 --- a/frontend/app/types/session/session.ts +++ b/frontend/app/types/session/session.ts @@ -358,11 +358,11 @@ export default class Session { const mixedEventsWithIssues = mergeEventLists( rawEvents, frustrationIssues - ).sort(sortEvents) + ) this.events = events; // @ts-ignore - this.notesWithEvents = mixedEventsWithIssues; + this.notesWithEvents = [...this.notesWithEvents, ...mixedEventsWithIssues].sort(sortEvents); this.errors = exceptions; this.issues = issuesList; // @ts-ignore legacy code? no idea @@ -377,16 +377,9 @@ export default class Session { addNotes(sessionNotes: Note[]) { // @ts-ignore this.notesWithEvents = - [...this.notesWithEvents, ...sessionNotes].sort((a, b) => { - // @ts-ignore just in case - const aTs = a.timestamp || a.time; - // @ts-ignore supporting old code... - const bTs = b.timestamp || b.time; - - return aTs - bTs; - }) || []; + [...this.notesWithEvents, ...sessionNotes].sort(sortEvents) || []; this.notes = sessionNotes; - + console.log(this.notesWithEvents, sessionNotes) return this; }