Files
familienarchiv/frontend/src/lib/notification
Marcel 30a8e36563
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 3m40s
CI / OCR Service Tests (pull_request) Successful in 22s
CI / Backend Unit Tests (pull_request) Successful in 3m36s
CI / fail2ban Regex (pull_request) Successful in 45s
CI / Semgrep Security Scan (pull_request) Successful in 23s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m5s
test(notification): make setNotifications authoritative in bell a11y tests
CI showed the single/many a11y tests failing with count 0: init()'s async
fetchUnreadCount resolved to {count:0} AFTER setNotifications() ran,
clobbering the seeded count (the flake Sara predicted in review). Stub
fetch to never settle so the announced count is driven solely by
setNotifications — deterministic, no race. Also rewrites the 'error' test
to seed a count then fail the load and assert the count SURVIVES, so it is
a meaningful state distinct from 'empty' (was byte-identical, flagged by
Felix/Sara/Leonie). Part of #560.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 10:32:00 +02:00
..

notification (frontend)

Bell-icon dropdown and real-time SSE connection for in-app notifications.

What this domain owns

Components: NotificationBell.svelte, NotificationDropdown.svelte. Utilities: notifications.svelte.ts (Svelte 5 reactive store), notifications.ts (API helpers).

What this domain does NOT own

  • SSE infrastructure — the backend's SseEmitterRegistry manages the server-side emitter. The frontend establishes one EventSource connection per session. Connection management lives in notifications.svelte.ts.
  • Notification content rendering — notification payloads contain a contextUrl; the frontend navigates there on click.

Key design: SSE connection

The SSE path is backend → browser directly (not proxied through SvelteKit SSR). The EventSource connects to /api/notifications/stream. On receive, the reactive store updates the unread count and the bell dropdown in real time.

Backend SseEmitterRegistry → /api/notifications/stream → EventSource in browser

Key components

Component Used in Notes
NotificationBell.svelte global nav (+layout.svelte) Bell icon with unread badge; opens NotificationDropdown
NotificationDropdown.svelte global nav Scrollable list of recent notifications with mark-read

Cross-domain imports

  • shared/primitives/ — icon, button primitives only

Backend counterpart

backend/src/main/java/org/raddatz/familienarchiv/notification/README.md