commit 35f4e7c78dd8e7ada289e2c1057fe3f35b2af1fd
parent 07a20040a43abf38d6a77365bbd6b8c3b0dabd8c
Author: William Casarin <jb55@jb55.com>
Date: Wed, 15 Mar 2023 15:50:13 -0600
Don't pop-in embedded note if we have it cached
Changelog-Changed: Fixed embedded note popping
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/damus/Views/Events/BuilderEventView.swift b/damus/Views/Events/BuilderEventView.swift
@@ -13,6 +13,19 @@ struct BuilderEventView: View {
@State var event: NostrEvent?
@State var subscription_uuid: String = UUID().description
+ init(damus: DamusState, event: NostrEvent) {
+ _event = State(initialValue: event)
+ self.damus = damus
+ self.event_id = event.id
+ }
+
+ init(damus: DamusState, event_id: String) {
+ let event = damus.events.lookup(event_id)
+ self.event_id = event_id
+ self.damus = damus
+ _event = State(initialValue: event)
+ }
+
func unsubscribe() {
damus.pool.unsubscribe(sub_id: subscription_uuid)
}
@@ -78,6 +91,9 @@ struct BuilderEventView: View {
.stroke(Color.gray.opacity(0.2), lineWidth: 1.0)
)
.onAppear {
+ guard event == nil else {
+ return
+ }
self.load()
}
}