Skip to content

feat(ui): auto-refresh chat on event gap with visual marker#3

Draft
brianleach wants to merge 5 commits intomainfrom
feat/auto-refresh-on-gap
Draft

feat(ui): auto-refresh chat on event gap with visual marker#3
brianleach wants to merge 5 commits intomainfrom
feat/auto-refresh-on-gap

Conversation

@brianleach
Copy link
Owner

Summary

  • When the web UI detects an event sequence gap (common after returning from a backgrounded tab), automatically reload chat history instead of showing a "refresh recommended" error
  • A visual gap divider marks where new messages begin, showing the count of messages that arrived while the user was away
  • The gap marker can be dismissed via its X button and is automatically cleared on manual refresh, session switch, or reconnect

Details

Before: gap detection set lastError with "event gap detected (expected seq X, got Y); refresh recommended" — user had to manually click refresh.

After: gap triggers loadChatHistory() automatically. If new messages appeared, an accent-colored divider is inserted at the boundary: "N new messages since you were away".

Files changed

File Change
ui/src/ui/app-gateway.ts Auto-refresh on gap instead of setting error
ui/src/ui/views/chat.ts Render gap divider + dismiss button
ui/src/ui/types/chat-types.ts New "gap" ChatItem kind
ui/src/styles/chat/grouped.css Gap divider styling (accent color)
ui/src/ui/app.ts chatGapIndex state
ui/src/ui/app-view-state.ts Type for chatGapIndex
ui/src/ui/app-render.ts Pass gap props to chat view
ui/src/ui/app-render.helpers.ts Clear gap on manual refresh
ui/src/ui/app-gateway.node.test.ts Updated + new tests, fixed Node 22 localStorage

Test plan

  • Open web UI, send a few messages, then background the tab
  • Trigger activity from another channel (Telegram, cron, etc.) so events are missed
  • Return to the tab — verify chat auto-refreshes and gap divider appears
  • Verify gap divider shows correct new message count
  • Click X on gap divider — verify it dismisses
  • Click manual refresh button — verify gap clears
  • Switch sessions — verify gap clears
  • Disconnect/reconnect — verify gap clears
  • Run ui/src/ui/app-gateway.node.test.ts — all 10 tests pass

brianleach and others added 5 commits February 25, 2026 20:25
The #if DEBUG check was unreliable for determining the APNs environment
because Xcode development provisioning profiles always produce sandbox
device tokens, even for Release builds. Now reads the aps-environment
entitlement from the embedded provisioning profile at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously the app only requested notification authorization lazily when
the gateway tried to deliver a push. Now it prompts immediately on first
launch so the user grants permission before notifications are needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the web UI detects an event sequence gap (common after returning
from a backgrounded tab), automatically reload chat history instead of
showing an error. A visual gap divider marks where new messages begin,
showing the count of messages that arrived while the user was away.

The gap marker can be dismissed via its X button and is automatically
cleared on manual refresh, session switch, or reconnect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant