fix: ssr crash

This commit is contained in:
Xyphyn committed 2023-09-26 20:13:54 -07:00
1 parent baea03a3c3
commit 5f1036ffb5
4 files changed
+16 -18

No files matched your search

+13 -9
View File
@@ -10,25 +10,29 @@
import PostFeed from '$lib/components/lemmy/post/PostFeed.svelte'
import { Button, Modal, toast } from 'mono-svelte'
import { afterNavigate } from '$app/navigation'
import { browser } from '$app/environment'
export let data
let sidebar: boolean = false
onMount(() => {
setSessionStorage('lastSeenCommunity', {
id: data.community.community_view.community.id,
name: fullCommunityName(
data.community.community_view.community.name,
data.community.community_view.community.actor_id
),
})
if (browser)
setSessionStorage('lastSeenCommunity', {
id: data.community.community_view.community.id,
name: fullCommunityName(
data.community.community_view.community.name,
data.community.community_view.community.actor_id
),
})
})
onDestroy(() => {
if ($navigating?.to?.route?.id == '/create/post') return
if (browser) {
if ($navigating?.to?.route?.id == '/create/post') return
setSessionStorage('lastSeenCommunity', undefined)
setSessionStorage('lastSeenCommunity', undefined)
}
})
</script>