fix: set lastProductId cookie in proxy instead of Server Component

Cookies can only be written in Server Actions or Route Handlers.
Moved the write to proxy.ts where NextResponse.cookies.set is allowed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-04-26 17:25:17 +02:00
parent d27c55c7fc
commit 1abbd4e5e4
2 changed files with 17 additions and 4 deletions

View file

@ -1,7 +1,6 @@
import { notFound, redirect } from 'next/navigation'
import { getSession } from '@/lib/auth'
import { getAccessibleProduct } from '@/lib/product-access'
import { setLastProductCookie } from '@/lib/cookies'
import { prisma } from '@/lib/prisma'
import { SoloBoard } from '@/components/solo/solo-board'
import { NoActiveSprint } from '@/components/solo/no-active-sprint'
@ -20,8 +19,6 @@ export default async function SoloProductPage({ params }: Props) {
const product = await getAccessibleProduct(id, session.userId)
if (!product) notFound()
await setLastProductCookie(id)
const sprint = await prisma.sprint.findFirst({
where: { product_id: id, status: 'ACTIVE' },
})