diff --git a/public/app.js b/public/app.js index 8876792..c3c2763 100644 --- a/public/app.js +++ b/public/app.js @@ -1,7 +1,14 @@ -// public/app.js - front-end entry point. Wires state, UI, API, and event stream. -import { api } from './js/api.js?v=34'; -import { createStream } from './js/stream.js?v=34'; -import * as ui from './js/ui.js?v=34'; +// public/app.js - front-end entry point. Wires state, UI, API, and SSE event stream. +// +// Architecture: +// - State is a small in-memory object (conversations, buddies, invites, active tab). +// - SSE events arrive from /api/events; handlers normalize/dedupe and update state + UI. +// - Dedupe matters because TOC/Web API paths and SSE replay can surface the same message; +// we use msgId when present, otherwise a short recent text/from/mine heuristic. +// - UI rendering is delegated to js/ui.js; API calls to js/api.js; SSE to js/stream.js. +import { api } from './js/api.js?v=35'; +import { createStream } from './js/stream.js?v=35'; +import * as ui from './js/ui.js?v=35'; window.addEventListener('error', (e) => { console.error('[ui] error', e.error || e.message); diff --git a/public/index.html b/public/index.html index 57b570f..8818a10 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@