fix(query): set default query retry to 1 (#5743)

* fix(query): set default query retry to 1

* fix(query): don't retry 404s and limit default retries to 3

* feat: expand status skipping checks

* feat: parallel fetch v2 and v3 in middleware

---------

Co-authored-by: Calum H. (IMB11) <contact@cal.engineer>
This commit is contained in:
Míngxuān Dìng
2026-04-16 19:31:26 +08:00
committed by GitHub
parent 5b5c8c06e3
commit 7b5c746757
2 changed files with 15 additions and 5 deletions

View File

@@ -32,10 +32,11 @@ export default defineNuxtRouteMiddleware(async (to) => {
const projectId = to.params.id as string
try {
// Fetch v2 project for redirect check AND cache it for the page
// Using fetchQuery ensures the page's useQuery gets this cached result
const project = await queryClient.fetchQuery(projectQueryOptions.v2(projectId, client))
const projectV3 = await queryClient.fetchQuery(projectQueryOptions.v3(projectId, client))
// Fetch v2 and v3 in parallel — cache both for the page's useQuery calls
const [project, projectV3] = await Promise.all([
queryClient.fetchQuery(projectQueryOptions.v2(projectId, client)),
queryClient.fetchQuery(projectQueryOptions.v3(projectId, client)),
])
// Let page handle 404
if (!project) return