Scrum4Me/components/sprint/sync-active-sprint-cookie.tsx
Madhura68 b4aa5d9949 fix: cookie-write uit Server Component (Next.js 16 verbiedt dit)
setActiveSprintCookie werd direct aangeroepen in app/(app)/products/[id]/sprint/[sprintId]/page.tsx,
wat in Next.js 16 een runtime-error oplevert ('Cookies can only be modified in a Server Action
or Route Handler'). Vervangen door een client-side bridge die syncActiveSprintCookieAction
aanroept na mount, zodat de active-sprint cookie nog steeds gesynced blijft met de URL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 01:54:27 +02:00

16 lines
371 B
TypeScript

'use client'
import { useEffect } from 'react'
import { syncActiveSprintCookieAction } from '@/actions/active-sprint'
interface Props {
productId: string
sprintId: string
}
export function SyncActiveSprintCookie({ productId, sprintId }: Props) {
useEffect(() => {
syncActiveSprintCookieAction(productId, sprintId)
}, [productId, sprintId])
return null
}