commit 37b964c296a442dbe46c72ef02296090a8cf046a
parent b1a2b471161c6d63afa355eb56068b3d1910dc76
Author: William Casarin <jb55@jb55.com>
Date: Tue, 21 Feb 2023 05:06:59 -0800
Fix issue where CPU is continuously pegged when scrolling
Since should_queue is continuosly getting set, this is causing the
InnerTimelineView to continuously rerender, pegging the CPU to 100%
This change only updates the var if it changes from the previous value.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/damus/Views/TimelineView.swift b/damus/Views/TimelineView.swift
@@ -32,7 +32,10 @@ struct TimelineView: View {
guard offset >= 0 else {
return
}
- self.events.should_queue = offset > 0
+ let val = offset > 0
+ if self.events.should_queue != val {
+ self.events.should_queue = val
+ }
}
var realtime_bar_opacity: Double {