Skip to content

Live status highlighting not syncing after system suspend/wake #27

@BP602

Description

@BP602

Bug Description

After waking the computer from suspend, chatroom tabs show incorrect live status highlighting (red border). Some tabs show as live when streamers are offline, and vice versa.

Steps to Reproduce

  1. Have multiple chatroom tabs open with mixed live/offline streamers
  2. Put computer to sleep/suspend
  3. Wake computer from suspend
  4. Observe that live status highlighting (red borders) no longer matches actual streamer status

Expected Behavior

Live status highlighting should automatically sync with actual streamer status after WebSocket reconnection.

Actual Behavior

Live status highlighting becomes out of sync:

  • Some offline streamers show red "live" highlighting
  • Some live streamers don't show red highlighting
  • Manual page reload fixes the issue

Technical Details

Root Cause: The automatic reconciliation logic added in commit 969ce05 is not working properly after suspend/wake cycles.

Code Location: src/renderer/src/providers/ChatProvider.jsx:860-881

The one-shot reconciliation should trigger when WebSocket reconnects after suspend:

// One-shot reconcile on reconnect: if we've connected before for this
// chatroom, fetch fresh channel info once to sync live status/title in
// case events were missed during suspend.
const wasConnectedBefore = __wsConnectedOnce.get(chatroom.id) === true;
__wsConnectedOnce.set(chatroom.id, true);
if (wasConnectedBefore) {
  setTimeout(async () => {
    try {
      const response = await window.app.kick.getChannelChatroomInfo(chatroom?.streamerData?.slug);
      if (response?.data) {
        const isLive = !!response.data?.livestream?.is_live;
        get().handleStreamStatus(chatroom.id, response.data, isLive);
      }
    } catch (error) {
      console.warn('[Reconnect Reconcile]: Failed to refresh channel info:', error?.message || error);
    }
  }, 1500);
}

Potential Issues:

  1. __wsConnectedOnce.get(chatroom.id) may not detect previous connections correctly after suspend
  2. 1500ms timeout might be insufficient after system suspend/resume
  3. API calls during reconciliation may be failing silently
  4. WebSocket reconnection detection may not be working properly

Diagnostic Evidence

Console API check showing mismatched state vs reality:

simpless: API=true, CSS=false (should be red/live but isn't)
zuck: API=true, CSS=false (should be red/live but isn't) 
4head: API=false, CSS=true (shows as live but actually offline)
xqc: API=false, CSS=true (shows as live but actually offline)

Environment

  • Recent changes: Commit 969ce05 "fix(navbar): keep live badge in sync via WS-only + reconnect reconcile"
  • WebSocket connection works normally (messages flowing)
  • Manual reload fixes the issue immediately

Suggested Fixes

  1. Add more robust logging to reconciliation logic
  2. Increase timeout duration for post-suspend reconciliation
  3. Add fallback reconciliation on window focus events
  4. Add telemetry to track reconciliation success/failure rates
  5. Consider triggering reconciliation on visibility change events

Workaround

Manual page reload fixes the live status highlighting immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions