fix undefined check

This commit is contained in:
Benjamin Palko 2025-06-18 10:13:30 -04:00
parent 590c0a0d43
commit fc5f3e9b08

View file

@ -7,10 +7,9 @@
let posts = $derived(data.posts);
</script>
{#if posts.length === 0}
{#if !posts || posts.length === 0}
<h3 class="text-center text-lg font-semibold">Looks like I haven't posted anything yet!</h3>
{/if}
{:else}
<div class="mx-auto grid gap-8 px-3 py-3 sm:px-8 sm:py-4 lg:grid-cols-2">
{#each posts as post (post.id)}
<BlogCard
@ -23,3 +22,4 @@
/>
{/each}
</div>
{/if}