fix: ssr crash
This commit is contained in:
1 parent
baea03a3c3
commit
5f1036ffb5
4 files changed
+16
-18
No files matched your search
@@ -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>
|
||||
|
||||
|
||||
@@ -157,11 +157,7 @@
|
||||
saved={post.post_view.saved}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
on:click={() => history.back()}
|
||||
size="square-md"
|
||||
class={history.length < 3 ? 'hidden' : ''}
|
||||
>
|
||||
<Button on:click={() => history.back()} size="square-md">
|
||||
<Icon src={ArrowLeft} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -47,9 +47,7 @@ export async function load({ params, url, fetch }) {
|
||||
post: post,
|
||||
commentSort: sort,
|
||||
streamed: {
|
||||
comments: SSR_ENABLED
|
||||
? await getClient(params.instance, fetch).getComments(commentParams)
|
||||
: getClient(params.instance, fetch).getComments(commentParams),
|
||||
comments: getClient(params.instance, fetch).getComments(commentParams),
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user