The single notifications stream owner — mount it exactly ONCE per app, in the
authenticated layout (portal: the dashboard layout; tracking: the
/workouts/today layout). It subscribes the shared store to the user's SSE
topic, emits an arrival PULSE on each new notification (consumers decide what
to do with it — the bell rings, and the portal also peeks), and refreshes the
unread count on tab-return (belt-and-suspenders — the reconnect snapshot
covers the rest). Renders a visually-hidden polite live region so new
notifications are announced to assistive tech, and no visible UI.
Returns Element
Remarks
Reads the token + user id once on mount, so it must sit inside the
app's auth guard. Logout clears the store separately (clearNotifications).
The single notifications stream owner — mount it exactly ONCE per app, in the authenticated layout (portal: the dashboard layout; tracking: the
/workouts/todaylayout). It subscribes the shared store to the user's SSE topic, emits an arrival PULSE on each new notification (consumers decide what to do with it — the bell rings, and the portal also peeks), and refreshes the unread count on tab-return (belt-and-suspenders — the reconnect snapshot covers the rest). Renders a visually-hidden polite live region so new notifications are announced to assistive tech, and no visible UI.