memos/web/src
Cursor Agent 8c743c72ba feat: add live memo refresh via Server-Sent Events (SSE)
Implement real-time memo synchronization across all open browser instances
using Server-Sent Events (SSE). When a memo is created, updated, or
deleted on one device, all other connected clients receive the change
notification and automatically refresh their data.

Backend changes:
- Add SSEHub (pub/sub) for broadcasting memo change events to connected clients
- Add SSE HTTP endpoint at /api/v1/sse with Bearer token authentication
  (supports both Authorization header and query parameter for EventSource)
- Broadcast memo.created, memo.updated, and memo.deleted events from
  the memo service after successful operations
- Include SSEHub in APIV1Service and wire it into server initialization
- Update test helper to include SSEHub to prevent nil pointer panics

Frontend changes:
- Add useLiveMemoRefresh hook that connects to SSE endpoint using fetch
  ReadableStream (supports custom auth headers unlike native EventSource)
- Automatically invalidate React Query caches on received events:
  - memo.created: invalidate memo lists + user stats
  - memo.updated: invalidate specific memo detail + memo lists
  - memo.deleted: remove memo from cache + invalidate lists + user stats
- Exponential backoff reconnection (1s to 30s) on connection failures
- Integrate hook in AppInitializer for app-wide live refresh
- Add SSE-specific Vite dev proxy config with no timeout for streaming

Co-authored-by: milvasic <milvasic@users.noreply.github.com>
2026-02-06 21:18:21 +00:00
..
components refactor: remove hide-scrollbar utility 2026-02-04 20:24:54 +08:00
contexts perf(react-query): fix context re-renders and improve type safety 2025-12-25 08:29:34 +08:00
helpers feat: react query migration (#5379) 2025-12-24 22:59:18 +08:00
hooks feat: add live memo refresh via Server-Sent Events (SSE) 2026-02-06 21:18:21 +00:00
layouts chore: simplify page loading logic 2026-01-27 23:37:32 +08:00
lib chore: add ActivityCalendar components 2025-12-28 19:59:36 +08:00
locales chore: update access token deletion message description for zh-Hans (#5573) 2026-02-04 19:54:51 +08:00
pages fix(auth): make PKCE optional for OAuth sign-in (#5570) 2026-02-02 23:28:21 +08:00
router chore: simplify page loading logic 2026-01-27 23:37:32 +08:00
themes chore: polish dark styles 2026-01-26 21:59:36 +08:00
types feat: update instance profile to use admin user instead of initialized flag 2026-01-28 23:27:53 +08:00
utils fix(auth): make PKCE optional for OAuth sign-in (#5570) 2026-02-02 23:28:21 +08:00
App.tsx feat: update instance profile to use admin user instead of initialized flag 2026-01-28 23:27:53 +08:00
auth-state.ts fix: prevent 401 errors on window focus when token expires 2026-02-05 22:14:48 +08:00
connect.ts fix: prevent 401 errors on window focus when token expires 2026-02-05 22:14:48 +08:00
i18n.ts refactor: remove MemoContentContext and integrate MemoViewContext 2025-12-28 12:46:12 +08:00
index.css feat: implement markdown components for enhanced rendering 2026-01-23 09:04:42 +08:00
instance-config.ts feat: react query migration (#5379) 2025-12-24 22:59:18 +08:00
main.tsx feat: add live memo refresh via Server-Sent Events (SSE) 2026-02-06 21:18:21 +00:00