Wait for note in NostrDB before rendering it
Closes: https://github.com/damus-io/damus/issues/2885 Changelog-Changed: Use NostrDB for rendering note contents Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@@ -376,7 +376,7 @@ func preload_event(plan: PreloadPlan, state: DamusState) async {
|
||||
//print("Preloading event \(plan.event.content)")
|
||||
|
||||
if artifacts == nil && plan.load_artifacts {
|
||||
let arts = render_note_content(ndb: state.ndb, ev: plan.event, profiles: profiles, keypair: our_keypair)
|
||||
let arts = await ContentRenderer().render_note_content(ndb: state.ndb, ev: plan.event, profiles: profiles, keypair: our_keypair)
|
||||
artifacts = arts
|
||||
|
||||
// we need these asap
|
||||
@@ -397,7 +397,13 @@ func preload_event(plan: PreloadPlan, state: DamusState) async {
|
||||
}
|
||||
|
||||
if plan.load_preview, note_artifact_is_separated(kind: plan.event.known_kind) {
|
||||
let arts = artifacts ?? render_note_content(ndb: state.ndb, ev: plan.event, profiles: profiles, keypair: our_keypair)
|
||||
let arts: NoteArtifacts
|
||||
if let artifacts {
|
||||
arts = artifacts
|
||||
}
|
||||
else {
|
||||
arts = await ContentRenderer().render_note_content(ndb: state.ndb, ev: plan.event, profiles: profiles, keypair: our_keypair)
|
||||
}
|
||||
|
||||
// only separated artifacts have previews
|
||||
if case .separated(let sep) = arts {
|
||||
|
||||
Reference in New Issue
Block a user