mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 03:55:59 +00:00
fix: tanstack query memory leak
This commit is contained in:
@@ -970,13 +970,10 @@ const showTinMismatchBanner = computed(() => {
|
|||||||
|
|
||||||
const PRIDE_COLLECTION_ID = 'M4c3ITvd'
|
const PRIDE_COLLECTION_ID = 'M4c3ITvd'
|
||||||
const PRIDE_ARTICLE_SLUGS = ['pride-campaign-2025', 'pride-campaign-2026', 'proud-of-you-2026']
|
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({
|
const { data: prideCollection } = useQuery({
|
||||||
queryKey: computed(() => ['collection', PRIDE_COLLECTION_ID]),
|
queryKey: computed(() => ['collection', PRIDE_COLLECTION_ID]),
|
||||||
queryFn: () => client.labrinth.collections.get(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 ?? []))
|
const prideProjectIds = computed(() => new Set(prideCollection.value?.projects ?? []))
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ export default defineNuxtPlugin((nuxt) => {
|
|||||||
if (import.meta.server) {
|
if (import.meta.server) {
|
||||||
nuxt.hooks.hook('app:rendered', () => {
|
nuxt.hooks.hook('app:rendered', () => {
|
||||||
vueQueryState.value = dehydrate(queryClient)
|
vueQueryState.value = dehydrate(queryClient)
|
||||||
|
|
||||||
|
// Hack to prevent memory leak when gcTime is being set on the server side.
|
||||||
|
queryClient.clear()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user