fix: tanstack query memory leak

This commit is contained in:
Michael H.
2026-08-29 02:31:35 +02:00
parent 7823f83d04
commit 1bee2f83d8
2 changed files with 3 additions and 3 deletions
-3
View File
@@ -970,13 +970,10 @@ const showTinMismatchBanner = computed(() => {
const PRIDE_COLLECTION_ID = 'M4c3ITvd'
const PRIDE_ARTICLE_SLUGS = ['pride-campaign-2025', 'pride-campaign-2026', 'proud-of-you-2026']
const PRIDE_CACHE_TIME = 1000 * 60 * 60 * 24
const { data: prideCollection } = useQuery({
queryKey: computed(() => ['collection', PRIDE_COLLECTION_ID]),
queryFn: () => client.labrinth.collections.get(PRIDE_COLLECTION_ID),
staleTime: PRIDE_CACHE_TIME,
gcTime: PRIDE_CACHE_TIME,
})
const prideProjectIds = computed(() => new Set(prideCollection.value?.projects ?? []))
+3
View File
@@ -29,6 +29,9 @@ export default defineNuxtPlugin((nuxt) => {
if (import.meta.server) {
nuxt.hooks.hook('app:rendered', () => {
vueQueryState.value = dehydrate(queryClient)
// Hack to prevent memory leak when gcTime is being set on the server side.
queryClient.clear()
})
}