From e4ebb320e5cc2fd2b31d3b97d6fe94c1f6bbd8c0 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 21 Jan 2023 17:01:23 -1000 Subject: [PATCH] review --- src/data/history.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/data/history.ts b/src/data/history.ts index 2e296c1c22..b717e0ed13 100644 --- a/src/data/history.ts +++ b/src/data/history.ts @@ -243,12 +243,11 @@ class HistoryStream { entityId in this.combinedHistory && entityId in streamMessage.states ) { + const lastCombined = this.combinedHistory[entityId][-1]; newHistory[entityId] = this.combinedHistory[entityId].concat( streamMessage.states[entityId] ); - if ( - streamMessage.states[entityId][0] > this.combinedHistory[entityId][-1] - ) { + if (streamMessage.states[entityId][0] > lastCombined) { // If the history is out of order we have to sort it. newHistory[entityId] = newHistory[entityId].sort( (a, b) => a.lu - b.lu