FCE-3852 Publish device toggled on while joining - #612
Merged
Merged
Conversation
6 tasks
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Two new tests fail strict TypeScript definite-assignment checking.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes device publication when camera or microphone activation completes during room joining.
Changes:
- Adds synchronous access to the latest peer status.
- Rechecks publication state after device startup.
- Adds race-condition regression tests.
File summaries
| File | Description |
|---|---|
packages/react-client/src/tests/toggleDuringJoin.spec.ts |
Tests device toggling across join timing scenarios. |
packages/react-client/src/hooks/internal/useTrackManager.ts |
Publishes or resumes tracks using current state. |
packages/react-client/src/hooks/internal/usePeerStatus.ts |
Tracks status in a ref for immediate reads. |
packages/react-client/src/FishjamProvider.tsx |
Supplies the status getter to track managers. |
Review details
Suppressed comments (1)
packages/react-client/src/tests/toggleDuringJoin.spec.ts:50
- This second callback-assigned promise has the same strict-mode definite-assignment error when it is later awaited. Mark it as definitely assigned (or initialize it) so
tsc --noEmitsucceeds.
let toggle: Promise<unknown>;
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
czerwiukk
approved these changes
Sep 18, 2026
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
A device turned on with
toggleMicrophone()/toggleCamera()whilejoinRoom()is in progress is now published once the peer joins.usePeerStatusalso returnsgetLatestPeerStatus(), read from a ref updated in the client event handlers (ahead of the re-render).toggleDevicere-reads the published track id and the latest peer status afterstartDevice()resolves, then publishes or resumes the track.joinedhandler still publishes it, once.Motivation and Context
If
joinedfired whilegetUserMediawas pending, nothing published the device:joinedhandler skipped it, because the device did not exist yet;toggleDevicestill saw"connecting"and no track id, both read before theawait.The device ran locally (
isMicrophoneOn: true), but the room got no track.Checked:
toggleDuringJoin.spec.ts: 3 tests fail before the fix, all 6 pass after.Documentation impact
Types of changes
not work as expected)