feat(messaging): #35 live-update the pending-connections badge via realtime#142
Merged
Merged
Conversation
…altime useConnections only fetched on mount, so the Connections-tab pending badge (UnifiedSidebar → ConnectionManager) went stale until a remount or manual action. Add a Supabase realtime subscription to user_connections (already in the supabase_realtime publication with REPLICA IDENTITY FULL) that refetches on change, debounced 1s to avoid re-render cascades — mirroring the proven ConversationList/useConversationList pattern, with proper removeChannel cleanup. Scope: just the badge-latency half of #35. The "mobile drawer transition polish" half is left out (subjective, no defect/acceptance criteria), and the unread-badge debounce is intentionally untouched (documented regression risk). Tests: subscribes to user_connections on mount, debounced refetch on a change event, channel removed on unmount. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partially addresses #35 (the badge-latency half).
What
useConnectionsonly fetched on mount, so the Connections-tab pending badge (UnifiedSidebar → ConnectionManager) stayed stale until a remount or manual action. Adds a Supabase realtime subscription touser_connections(already in thesupabase_realtimepublication withREPLICA IDENTITY FULL) that refetches on change — debounced 1s to avoid re-render cascades, mirroring the provenConversationList/useConversationListpattern, with properremoveChannelcleanup.Scope
Just the badge-latency half of #35. The "mobile drawer transition polish" half is intentionally left out (subjective, no defect/acceptance criteria), and the unread-badge debounce is untouched (documented regression risk). So #35 stays open for the drawer-polish piece if you want it later — but the concrete badge bug is fixed.
Verification
user_connectionson mount, debounced refetch on a change event, channel removed on unmount.🤖 Generated with Claude Code