- answer-modal: __content (scroll area), __submit (footer) - notifications-bridge: skip comment (bridge, non-rendering wrapper) - notifications-realtime-mount: skip comment (returns null) - notifications-sheet: __header, __items (questions list) - push-toggle: __switch (button), __label (button text) on subscribed/unsubscribed states
24 lines
852 B
TypeScript
24 lines
852 B
TypeScript
// 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()
|
|
// debug-id: skip — render-loos mount (returns null, zie docs/patterns/debug-id.md)
|
|
return null
|
|
}
|