feat: nieuwe sprint wordt direct geselecteerd zonder redirect
createSprintAction zet nu de active-sprint cookie naar de zojuist aangemaakte sprint, en de StartSprintButton refresht de huidige pagina i.p.v. te redirecten naar /sprint. Resultaat: gebruiker blijft op de product backlog en ziet de nieuwe sprint direct geselecteerd in de sprint-pulldown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d90d8a8aa2
commit
486736f267
3 changed files with 3 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
|
||||
vi.mock('next/cache', () => ({ revalidatePath: vi.fn() }))
|
||||
vi.mock('next/headers', () => ({ cookies: vi.fn().mockResolvedValue({}) }))
|
||||
vi.mock('next/headers', () => ({ cookies: vi.fn().mockResolvedValue({ set: vi.fn(), get: vi.fn(), delete: vi.fn() }) }))
|
||||
vi.mock('iron-session', () => ({
|
||||
getIronSession: vi.fn().mockResolvedValue({ userId: 'user-1', isDemo: false }),
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ export async function createSprintAction(_prevState: unknown, formData: FormData
|
|||
}),
|
||||
)
|
||||
|
||||
await setActiveSprintCookie(parsed.data.productId, sprint.id)
|
||||
revalidatePath(`/products/${parsed.data.productId}`)
|
||||
return { success: true, sprintId: sprint.id }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export function StartSprintButton({ productId, isDemo = false }: StartSprintButt
|
|||
if (result?.success) {
|
||||
setOpen(false)
|
||||
setDirty(false)
|
||||
router.push(`/products/${productId}/sprint`)
|
||||
router.refresh()
|
||||
} else if (result?.code !== 422 && result?.error) {
|
||||
// Toast handled by caller; here we just keep the form open
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue