Skip to content

Commit ef14d5f

Browse files
committed
fix: defer preview computation to browser to fix hydration
1 parent 1906b1b commit ef14d5f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/routes/bot/profile/+page.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { browser } from '$app/environment';
23
import { enhance } from '$app/forms';
34
let { data, form } = $props();
45
let profile = $derived(data.profile);
@@ -29,8 +30,8 @@
2930
return `${pfx}${changes} in "${preview.title}" (${preview.feedName})\n${stats}\n\nhttps://diff.example.com/diff/${preview.diffId}\nhttps://example.com/article${sfx}`;
3031
}
3132
32-
let apPreview = $derived(buildPreview(apPrefixInput, apSuffixInput));
33-
let bskyPreview = $derived(buildPreview(bskyPrefixInput || apPrefixInput, bskySuffixInput || apSuffixInput));
33+
let apPreview = $derived(browser ? buildPreview(apPrefixInput, apSuffixInput) : '');
34+
let bskyPreview = $derived(browser ? buildPreview(bskyPrefixInput || apPrefixInput, bskySuffixInput || apSuffixInput) : '');
3435
let apBudget = $derived(AP_LIMIT - apPreview.length);
3536
let bskyBudget = $derived(BSKY_LIMIT - bskyPreview.length);
3637

0 commit comments

Comments
 (0)