Skip to content

Commit

Permalink
fix: ssr issue, close #378
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyphyn committed Jul 25, 2024
1 parent 998dcb7 commit 3631cb4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/components/lemmy/dropdowns/Sort.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
export let navigate: boolean = true
export let changeDefault: boolean = false
let sort: string = selected.startsWith('Top') ? 'TopAll' : selected
let sort: string = selected?.startsWith('Top') ? 'TopAll' : selected
$: if (selected) {
sort = selected.startsWith('Top') ? 'TopAll' : selected
sort = selected?.startsWith('Top') ? 'TopAll' : selected
}
const setSelected = () => (selected = sort)
$: changeDefault
Expand Down
11 changes: 10 additions & 1 deletion src/lib/lemmy/postfeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,16 @@ export async function postFeed(args: {
instance: get(instance),
})

return get(postFeeds)[args.id].data
return (
get(postFeeds)[args.id]?.data ?? {
...args.request,
posts: posts,
cursor: {
next: posts.next_page,
},
type_: args.request.type_,
}
)
}

export function getPostFeed(feeds: Map<PostFeedID, PostFeed>, id: PostFeedID) {
Expand Down

0 comments on commit 3631cb4

Please sign in to comment.