commit f4024895bad2ea2301acbe0a56b8d1306bfbb4b4 parent bcdd0b4e2332c82ef664adc62e9e13d28be20e5c Author: William Casarin <jb55@jb55.com> Date: Wed, 14 Jun 2023 09:20:51 +0200 threads: attempt to fix state jankiness Changelog-Fixed: Fix some more thread jankiness Diffstat:
M | damus/Views/ThreadView.swift | | | 18 | ++++++++++-------- |
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/damus/Views/ThreadView.swift b/damus/Views/ThreadView.swift @@ -9,19 +9,21 @@ import SwiftUI struct ThreadView: View { let state: DamusState - @ObservedObject var thread: ThreadModel + + var body: some View { + ThreadView_(state: state, thread: thread, zaps: state.events.get_cache_data(thread.event.id).zaps_model) + } +} + +struct ThreadView_: View { + let state: DamusState + + let thread: ThreadModel @ObservedObject var zaps: ZapsDataModel @Environment(\.dismiss) var dismiss - init(state: DamusState, thread: ThreadModel) { - self.state = state - self._thread = ObservedObject(wrappedValue: thread) - let zaps = state.events.get_cache_data(thread.event.id).zaps_model - self._zaps = ObservedObject(wrappedValue: zaps) - } - var parent_events: [NostrEvent] { state.events.parent_events(event: thread.event) }