Summary
When a node connects fresh and syncs history from the server, the NotificationManager subscribes to each room's message query before that history has synced, so the synced messages arrive via changeset.added() (i.e. after the subscription started) and get counted as unread. A freshly-synced device therefore shows unread badges for pre-existing history on first connect.
Observed
Two simulators connected to the seeded server both showed badges on first connect — e.g. Scroll Test "10+" and General "1" — for messages that already existed on the server before the device connected.
Notes
- This matches the reference (react/leptos) subscription mechanism — it's inherent to "count messages that appear after the subscription starts", not a regression in the RN port. (The
added() vs initial-load distinction only skips history that is already local when the query subscribes.)
- As UX it may be undesirable: a new device arguably shouldn't mark all existing history as unread.
Options
- Leave as-is (consistent with the other templates).
- Pre-mark history as read on initial sync per room (treat the first settled resultset as a read baseline).
- Only count messages whose timestamp is newer than when the manager started.
Acceptance
Summary
When a node connects fresh and syncs history from the server, the
NotificationManagersubscribes to each room's message query before that history has synced, so the synced messages arrive viachangeset.added()(i.e. after the subscription started) and get counted as unread. A freshly-synced device therefore shows unread badges for pre-existing history on first connect.Observed
Two simulators connected to the seeded server both showed badges on first connect — e.g. Scroll Test "10+" and General "1" — for messages that already existed on the server before the device connected.
Notes
added()vs initial-load distinction only skips history that is already local when the query subscribes.)Options
Acceptance