fix(react-client): clear VAD outline on peer reconnect#523
Merged
MiloszFilimowski merged 2 commits intoApr 24, 2026
Merged
Conversation
useVAD cached vadStatus per trackId and never dropped entries for tracks that disappeared. A peer disconnecting mid-speech left an oldTrackId -> "speech" entry behind; after reconnect the OR-reduce over the map kept returning true regardless of the new track's status. Derive the per-peer boolean directly from current mic tracks; use voiceActivityChanged only as a re-render trigger.
MiloszFilimowski
approved these changes
Apr 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a stale “speaking” indicator after a peer disconnects mid-speech and reconnects, by making useVAD derive each peer’s speaking state from the current live microphone track list rather than a cached per-trackId map.
Changes:
- Remove the per-
trackIdVAD cache/state and compute speaking booleans directly from the current mic track’svadStatus. - Use a
useReducerversion counter to force re-renders onvoiceActivityChangedevents (since the track context is mutated in place).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
Fixes: FCE-3199 |
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.
Description
Rewrite
useVADto derive each peer's speaking boolean directly from the current microphone tracks instead of a per-trackIdcache.voiceActivityChangednow only drives a re-render via a version counter.This is a crude fix scoped to
useVAD. The underlying invariant — that a track's last observedvadStatusissilencewhen it disappears — is still not enforced at the webrtc-client layer, so other consumers ofFishjamTrackContext.vadStatuscould hit the same class of bug.Motivation and Context
When a peer disconnected mid-speech, their track was removed without a final
silencevadNotification, leaving a staleoldTrackId -> "speech"entry inuseVAD's cache. On reconnect the new track wrote under a newtrackId, so the OR-reduceObject.values(tracks).some(v => v === "speech")kept returningtrueand the talking-indicator outline stayed stuck on for every other viewer. Deriving from the live track list auto-prunes vanished tracks, so there is no state left to go stale.Documentation impact
Types of changes