migrate: switch run() to $effect

This commit is contained in:
Xylight committed 2024-10-26 11:13:00 -07:00
1 parent 1b4bb96003
commit c75e0cc4b7
4 files changed
+16 -11

No files matched your search

@@ -177,15 +177,15 @@
}
})
onMount(async () => {
await tick()
$virtualizer.measure()
})
// onMount(async () => {
// await tick()
// $virtualizer.measure()
// })
let items = $derived($virtualizer.getVirtualItems())
run(() => {
if (virtualItemEls.length) {
$effect(() => {
if (virtualItemEls.length)
virtualItemEls.forEach($virtualizer.measureElement)
}
})
run(() => {
if (posts.length && virtualListEl)
@@ -41,7 +41,7 @@
? '!bg-slate-100 dark:!bg-zinc-900'
: ''}"
>
{#snippet icon()}
{#snippet customIcon()}
<ProfileAvatar
profile={prof}
{index}
@@ -47,7 +47,9 @@
: ''} {clazz}"
>
{#snippet prefix()}
{#if customIcon}{@render customIcon({ selected })}{:else if icon}
{#if customIcon}
{@render customIcon({ selected })}
{:else if icon}
<Icon src={icon} solid={selected} size="20" />
{/if}
{/snippet}