Page now fetches tasks parallel to stories and groups by story_id. BacklogHydrationWrapper calls setInitialData on mount so the store is ready for downstream SSE consumers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
715 B
TypeScript
26 lines
715 B
TypeScript
'use client'
|
|
|
|
import { useEffect } from 'react'
|
|
import { useBacklogStore, type BacklogPbi, type BacklogStory, type BacklogTask } from '@/stores/backlog-store'
|
|
|
|
interface InitialData {
|
|
pbis: BacklogPbi[]
|
|
storiesByPbi: Record<string, BacklogStory[]>
|
|
tasksByStory: Record<string, BacklogTask[]>
|
|
}
|
|
|
|
interface BacklogHydrationWrapperProps {
|
|
initialData: InitialData
|
|
children: React.ReactNode
|
|
}
|
|
|
|
export function BacklogHydrationWrapper({ initialData, children }: BacklogHydrationWrapperProps) {
|
|
const setInitialData = useBacklogStore((s) => s.setInitialData)
|
|
|
|
useEffect(() => {
|
|
setInitialData(initialData)
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [])
|
|
|
|
return <>{children}</>
|
|
}
|