[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix virtual list indexes not updating

Kasper (Sep 26, 2024, 3:20 AM +0200) 6ba21f66 b6d64df2

+5 -1
+5 -1
src/components/VirtualListBlock.svelte
··· 31 31 let start_index = 0 32 32 let visible_count = 0 33 33 34 + // Workaround for svelte not updating the indexes when the keys change 35 + $: visible_count_obj = { length: visible_count } 36 + 34 37 $: { 35 38 items, item_height, buffer 36 39 if (scroll_container && main_element) refresh() ··· 71 74 72 75 start_index = Math.floor(start_pixel / item_height) 73 76 visible_count = Math.ceil(end_pixel / item_height) - start_index 77 + visible_count_obj = { length: visible_count } 74 78 } 75 79 76 80 $: apply_scroll_event_handler(scroll_container) ··· 103 107 style:padding-top={start_index * item_height + 'px'} 104 108 style:height={items.length * item_height + 'px'} 105 109 > 106 - {#each { length: visible_count } as _, i (get_key(items[i + start_index], i + start_index))} 110 + {#each visible_count_obj as _, i (get_key(items[i + start_index], i + start_index))} 107 111 <slot item={items[i + start_index]} i={i + start_index} /> 108 112 {/each} 109 113 </div>