fix: posts not reloading when changing instance

This commit is contained in:
Xylight committed 2024-07-06 18:14:29 -07:00
1 parent c8efc4c44b
commit 6a4a60ec7d
2 files changed
+6 -9

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@ import { userSettings } from '$lib/settings.js'
import type { GetPostsResponse, ListingType, SortType } from 'lemmy-js-client'
import { get, writable } from 'svelte/store'
import { error } from '@sveltejs/kit'
import { _posts, shouldReload } from './+page.svelte'
import { _posts, shouldReload, type CachedPosts } from './+page.svelte'
import { browser } from '$app/environment'
import { instance } from '$lib/instance'
@@ -19,7 +19,7 @@ export async function load({ url, fetch }) {
const listingType: ListingType =
(url.searchParams.get('type') as ListingType) || settings.defaultSort.feed
const cached = get(_posts)
const cached: CachedPosts | undefined = get(_posts)
const posts = shouldReload(cached, url.searchParams.toString(), get(instance))
? await getClient(undefined, fetch).getPosts({