migrate: fix reactivity issues in data lists
This commit is contained in:
1 parent
104a99f394
commit
87fba8af04
4 files changed
+22
-13
No files matched your search
@@ -34,6 +34,11 @@
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
let communities = $state(data.communities)
|
||||
$effect(() => {
|
||||
communities = data.communities
|
||||
})
|
||||
|
||||
let search = $state(data.query || '')
|
||||
let searchElement: HTMLInputElement | undefined = $state()
|
||||
let instance = ''
|
||||
@@ -99,7 +104,7 @@
|
||||
<ul
|
||||
class="flex flex-col divide-y divide-slate-100 dark:divide-zinc-800 my-6 h-full"
|
||||
>
|
||||
{#if data.communities.length == 0}
|
||||
{#if communities.length == 0}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
title={$t('routes.search.noResults.title')}
|
||||
@@ -114,7 +119,7 @@
|
||||
<div
|
||||
class="grid md:grid-cols-2 lg:grid-cols-3 gap-4 items-center mb-6 !border-0"
|
||||
>
|
||||
{#each data.communities.slice(0, 3) as community, index (community.community.id)}
|
||||
{#each communities.slice(0, 3) as community, index (community.community.id)}
|
||||
<div
|
||||
class="h-full"
|
||||
in:fly|global={{
|
||||
@@ -142,13 +147,13 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if data.communities.slice(showTop ? 3 : 0).length > 0}
|
||||
{#if communities.slice(showTop ? 3 : 0).length > 0}
|
||||
<SectionTitle class="!border-0 pb-2">
|
||||
{$t('routes.search.other')}
|
||||
</SectionTitle>
|
||||
{/if}
|
||||
{#if data.communities}
|
||||
{@const sliced = data.communities.slice(showTop ? 3 : 0)}
|
||||
{#if communities}
|
||||
{@const sliced = communities.slice(showTop ? 3 : 0)}
|
||||
<div class="-mx-4 sm:-mx-6 h-full">
|
||||
{#each sliced as community, index (community.community.id)}
|
||||
<div
|
||||
@@ -167,7 +172,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</ul>
|
||||
{#if data.communities.length > 0}
|
||||
{#if communities.length > 0}
|
||||
<div
|
||||
class="sticky z-30 mx-auto max-w-full"
|
||||
style="bottom: max(1.5rem, {$contentPadding.bottom}px);"
|
||||
|
||||
Reference in new issue
Block a user