Don't pop-in embedded note if we have it cached

Changelog-Changed: Fixed embedded note popping
This commit is contained in:
William Casarin
2023-03-15 15:50:13 -06:00
parent 07a20040a4
commit 35f4e7c78d

View File

@@ -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()
}
}