fix: chart flickering (#644) @Hans1208

This commit is contained in:
Hans 2023-02-09 06:32:16 +09:00 committed by GitHub
parent dd02cdb564
commit 5e3d6b7788
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,12 +17,19 @@ export default class Status {
upspeedRaw: number = 0
constructor(in_state?: Optional<ServerState>) {
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