Scrum4Me/components/backlog/backlog-hydration-wrapper.tsx
Madhura68 75bbb1ad73 feat(backlog): server-fetch tasks + hydrate BacklogStore on page load
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>
2026-04-30 17:15:41 +02:00

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}</>
}