fix: stale cache handling (#5253)
* fix: allow stale cache * fix: cache amnt * fix: other one asw
This commit is contained in:
@@ -1551,8 +1551,7 @@ const {
|
|||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: computed(() => ['project', projectId.value, 'dependencies']),
|
queryKey: computed(() => ['project', projectId.value, 'dependencies']),
|
||||||
queryFn: () => client.labrinth.projects_v2.getDependencies(projectId.value),
|
queryFn: () => client.labrinth.projects_v2.getDependencies(projectId.value),
|
||||||
staleTime: 1000 * 60 * 5,
|
staleTime: 1000 * 60 * 10,
|
||||||
enabled: false, // Never auto-fetch, always triggered manually
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const dependencies = computed(() => dependenciesRaw.value ?? null)
|
const dependencies = computed(() => dependenciesRaw.value ?? null)
|
||||||
@@ -1570,8 +1569,7 @@ const {
|
|||||||
include_changelog: false,
|
include_changelog: false,
|
||||||
apiVersion: 3,
|
apiVersion: 3,
|
||||||
}),
|
}),
|
||||||
staleTime: 1000 * 60 * 5,
|
staleTime: 1000 * 60 * 10,
|
||||||
enabled: false, // Never auto-fetch, always triggered manually
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Organization
|
// Organization
|
||||||
|
|||||||
@@ -610,6 +610,21 @@ if (route.params.version === 'create') {
|
|||||||
foundVersion.changelog = versionV3.changelog
|
foundVersion.changelog = versionV3.changelog
|
||||||
}
|
}
|
||||||
version.value = foundVersion
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user