commit 0b5d68c0b8fc78b1be69db87588926c75534d612 parent f4024895bad2ea2301acbe0a56b8d1306bfbb4b4 Author: William Casarin <jb55@jb55.com> Date: Wed, 14 Jun 2023 09:30:58 +0200 Revert "threads: attempt to fix state jankiness" This reverts commit f4024895bad2ea2301acbe0a56b8d1306bfbb4b4. Diffstat:
M | damus/Views/ThreadView.swift | | | 18 | ++++++++---------- |
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/damus/Views/ThreadView.swift b/damus/Views/ThreadView.swift @@ -9,21 +9,19 @@ 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 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) }