Reduce feed reflow from new replies

This commit is contained in:
Jonathan Staab 2023-01-03 04:19:35 -08:00
parent 7374b8f085
commit 06b357de1d
3 changed files with 7 additions and 2 deletions

View File

@ -28,6 +28,7 @@ If you like Coracle and want to support its development, you can donate sats via
# Bugs # Bugs
- [ ] Reduce reflow on feeds from new stuff coming in
- [ ] Follow fiatjaf's vision of clients being smart and connecting to recommended relays to fetch content - [ ] Follow fiatjaf's vision of clients being smart and connecting to recommended relays to fetch content
- [ ] Add alerts for replies to posts the user liked - [ ] Add alerts for replies to posts the user liked
- [ ] Stack views so scroll position isn't lost on navigation - [ ] Stack views so scroll position isn't lost on navigation

View File

@ -17,6 +17,7 @@
import relay, {user} from 'src/relay' import relay, {user} from 'src/relay'
export let note export let note
export let until = Infinity
export let depth = 0 export let depth = 0
export let anchorId = null export let anchorId = null
export let showParent = true export let showParent = true
@ -181,7 +182,9 @@
</div> </div>
{/if} {/if}
{#each note.replies as r (r.id)} {#each note.replies as r (r.id)}
{#if r.created_at < until}
<svelte:self showParent={false} note={r} depth={depth - 1} {invertColors} {anchorId} /> <svelte:self showParent={false} note={r} depth={depth - 1} {invertColors} {anchorId} />
{/if}
{/each} {/each}
</div> </div>
{/if} {/if}

View File

@ -22,6 +22,7 @@
) )
}) })
let depth = 2
let until = now() let until = now()
let newNotes = [] let newNotes = []
let newNotesLength = 0 let newNotesLength = 0
@ -46,8 +47,8 @@
Load {quantify(newNotesLength, 'new note')} Load {quantify(newNotesLength, 'new note')}
</div> </div>
{/if} {/if}
{#each visibleNotes as n (n.id)} {#each visibleNotes as note (note.id)}
<li><Note note={n} depth={2} /></li> <li><Note {until} {note} {depth} /></li>
{/each} {/each}
</ul> </ul>