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>
This commit is contained in:
parent
1a5c0b2d01
commit
b4aa5d9949
3 changed files with 39 additions and 3 deletions
16
components/sprint/sync-active-sprint-cookie.tsx
Normal file
16
components/sprint/sync-active-sprint-cookie.tsx
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
'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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue