From 07e81ac0362d8091b8e207036a3f209781bad9d0 Mon Sep 17 00:00:00 2001 From: Truman Gao <106889354+tdgao@users.noreply.github.com> Date: Thu, 21 May 2026 11:02:53 -0600 Subject: [PATCH] fix: project embeds (#6152) * fix: project embeds * remove: params.id --- apps/frontend/src/middleware/project.global.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/frontend/src/middleware/project.global.ts b/apps/frontend/src/middleware/project.global.ts index af34e10c3..27b6da832 100644 --- a/apps/frontend/src/middleware/project.global.ts +++ b/apps/frontend/src/middleware/project.global.ts @@ -20,8 +20,13 @@ const PROJECT_TYPES = [ export default defineNuxtRouteMiddleware(async (to) => { // Only run this middleware on the server - it relies on server-only runtime config if (import.meta.client) return + + const routeProjectParam = to.params.project + const projectId = Array.isArray(routeProjectParam) ? routeProjectParam[0] : routeProjectParam + const routeType = Array.isArray(to.params.type) ? to.params.type[0] : to.params.type + // Only handle project routes - if (!to.params.id || !PROJECT_TYPES.includes(to.params.type as string)) { + if (!projectId || !routeType || !PROJECT_TYPES.includes(routeType)) { return } @@ -29,7 +34,6 @@ export default defineNuxtRouteMiddleware(async (to) => { const authToken = useCookie('auth-token') const client = useServerModrinthClient({ authToken: authToken.value || undefined }) const tags = useGeneratedState() - const projectId = to.params.id as string try { // Fetch v2 and v3 in parallel — cache both for the page's useQuery calls