From 44f611cf400283833cec8ed5fb22acf5ce589021 Mon Sep 17 00:00:00 2001 From: shinya Date: Sat, 16 Aug 2025 22:34:12 +0800 Subject: [PATCH] feat: search api remove cache header when result is empty --- src/app/api/search/route.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index 5060fe5..11b18bb 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -57,6 +57,11 @@ export async function GET(request: Request) { } const cacheTime = await getCacheTime(); + if (flattenedResults.length === 0) { + // no cache if empty + return NextResponse.json({ results: [] }, { status: 200 }); + } + return NextResponse.json( { results: flattenedResults }, {