From 5e3d6b778892fc6b157ba533f288e77ceed091c7 Mon Sep 17 00:00:00 2001 From: Hans Date: Thu, 9 Feb 2023 06:32:16 +0900 Subject: [PATCH] fix: chart flickering (#644) @Hans1208 --- src/models/Status.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/models/Status.ts b/src/models/Status.ts index 27015f28..d416b3d1 100644 --- a/src/models/Status.ts +++ b/src/models/Status.ts @@ -17,12 +17,19 @@ export default class Status { upspeedRaw: number = 0 constructor(in_state?: Optional) { + const previous = store.state.status + if (!in_state) { + this.alltimeDownloaded = previous.alltimeDownloaded + this.alltimeUploaded = previous.alltimeUploaded + this.freeDiskSpace = previous.freeDiskSpace + this.sessionDownloaded = previous.sessionDownloaded + this.sessionUploaded = previous.sessionUploaded + + Object.freeze(this) return } - const previous = store.state.status - this.alltimeDownloaded = in_state.alltime_dl || previous.alltimeDownloaded this.alltimeUploaded = in_state.alltime_ul || previous.alltimeUploaded this.altSpeed = in_state.use_alt_speed_limits !== undefined ? in_state.use_alt_speed_limits : previous.altSpeed