From 2fb63ad5061290aed2d7b3d716050ce26526ad7b Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Mon, 29 Dec 2025 21:50:48 +1000 Subject: [PATCH] fix: use two-step query to fix scoped package 404s on tool detail page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The relation filter `package: { npmPackageName }` was not working correctly. Now first find the package, then find the tool by packageId. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- apps/web/src/app/tool/[...slug]/page.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/web/src/app/tool/[...slug]/page.tsx b/apps/web/src/app/tool/[...slug]/page.tsx index 917323b..9ffed80 100644 --- a/apps/web/src/app/tool/[...slug]/page.tsx +++ b/apps/web/src/app/tool/[...slug]/page.tsx @@ -33,9 +33,19 @@ async function getTool(slug: string[]): Promise { return null; } + // First find the package by npm name + const pkg = await prisma.package.findUnique({ + where: { npmPackageName: packageName }, + }); + + if (!pkg) { + return null; + } + + // Then find the tool using packageId const tool = await prisma.tool.findFirst({ where: { - package: { npmPackageName: packageName }, + packageId: pkg.id, ...(exportName && { name: exportName }), }, include: {