Fix: Validate beat time before appending

This commit is contained in:
Nelson Chan 2021-10-22 19:07:11 +08:00
parent 445674aacb
commit e4be28a9e7
1 changed files with 4 additions and 1 deletions

View File

@ -230,7 +230,10 @@ export default {
this.$watch(() => this.$root.heartbeatList[this.monitorId], this.$watch(() => this.$root.heartbeatList[this.monitorId],
(heartbeatList) => { (heartbeatList) => {
if (this.chartPeriodHrs != 0) { if (this.chartPeriodHrs != 0) {
this.heartbeatList.push(heartbeatList.at(-1)); const newBeat = heartbeatList.at(-1);
if (newBeat && dayjs.utc(newBeat.time) > dayjs.utc(this.heartbeatList.at(-1)?.time)) {
this.heartbeatList.push(heartbeatList.at(-1));
}
} }
}, },
{ deep: true } { deep: true }