// ST-1105: Tiny client island dat de notifications-store hydrateert met
// server-side fetched initial questions en de SSE-realtime hook activeert.

'use client'

import { useEffect } from 'react'
import { useNotificationsStore, type NotificationQuestion } from '@/stores/notifications-store'
import { useNotificationsRealtime } from '@/lib/realtime/use-notifications-realtime'

interface Props {
  initial: NotificationQuestion[]
}

export function NotificationsRealtimeMount({ initial }: Props) {
  // Hydrate de store met server-side-rendered data zodat de bell-count direct
  // klopt zonder te wachten op de SSE state-event.
  useEffect(() => {
    useNotificationsStore.getState().init(initial)
  }, [initial])

  useNotificationsRealtime()
  return null
}
