diff --git a/src/agent/network.ts b/src/agent/network.ts index 51f6ab29..ca9d4b98 100644 --- a/src/agent/network.ts +++ b/src/agent/network.ts @@ -173,7 +173,15 @@ const streamContext = ({notes, onChunk, depth = 0}) => } depth -= 1 - events = await load({relays, filter, onChunk}) + + const promise = load({relays, filter, onChunk}) + + // Don't await the promise when we're on the last level, since we won't be + // displaying those replies, and we await `load` before showing children + // to reduce reflow + if (depth > 0) { + events = await promise + } } }) ) diff --git a/src/partials/Notes.svelte b/src/partials/Notes.svelte index 9e4942bc..81b26d82 100644 --- a/src/partials/Notes.svelte +++ b/src/partials/Notes.svelte @@ -18,6 +18,7 @@ let notes = [] let notesBuffer = [] + let showReplies = false const since = now() const maxNotes = 100 @@ -48,6 +49,8 @@ onChunk: context => { notes = network.applyContext(notes, context) }, + }).then(() => { + showReplies = true }) // Show replies grouped by parent whenever possible @@ -108,7 +111,7 @@