From 5624e86c2bdf212c6ef74fffeb66738a7de610eb Mon Sep 17 00:00:00 2001 From: "Calum H." Date: Fri, 30 Jan 2026 16:41:03 +0000 Subject: [PATCH] fix: stale cache handling (#5253) * fix: allow stale cache * fix: cache amnt * fix: other one asw --- apps/frontend/src/pages/[type]/[id].vue | 6 ++---- .../src/pages/[type]/[id]/version/[version].vue | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/frontend/src/pages/[type]/[id].vue b/apps/frontend/src/pages/[type]/[id].vue index a8f988e8e..2fd6aa944 100644 --- a/apps/frontend/src/pages/[type]/[id].vue +++ b/apps/frontend/src/pages/[type]/[id].vue @@ -1551,8 +1551,7 @@ const { } = useQuery({ queryKey: computed(() => ['project', projectId.value, 'dependencies']), queryFn: () => client.labrinth.projects_v2.getDependencies(projectId.value), - staleTime: 1000 * 60 * 5, - enabled: false, // Never auto-fetch, always triggered manually + staleTime: 1000 * 60 * 10, }) const dependencies = computed(() => dependenciesRaw.value ?? null) @@ -1570,8 +1569,7 @@ const { include_changelog: false, apiVersion: 3, }), - staleTime: 1000 * 60 * 5, - enabled: false, // Never auto-fetch, always triggered manually + staleTime: 1000 * 60 * 10, }) // Organization diff --git a/apps/frontend/src/pages/[type]/[id]/version/[version].vue b/apps/frontend/src/pages/[type]/[id]/version/[version].vue index 9a7d56fa9..d3141057d 100644 --- a/apps/frontend/src/pages/[type]/[id]/version/[version].vue +++ b/apps/frontend/src/pages/[type]/[id]/version/[version].vue @@ -610,6 +610,21 @@ if (route.params.version === 'create') { foundVersion.changelog = versionV3.changelog } version.value = foundVersion + } else { + // cache is stale (e.g., version was just created/reuploaded) + try { + const versionV3 = (await useBaseFetch( + `project/${project.value.id}/version/${route.params.version}`, + { apiVersion: 3 }, + )) as any + if (versionV3) { + version.value = versionV3 + // Refresh versions cache to include this version + await refreshVersions() + } + } catch { + // API fetch failed - version truly doesn't exist, will 404 below + } } }