Azure / Azure/communication-ui-library
When a breakout room is closed by the host, meeting ends prematurely
- Dominant language
- TypeScript
- Stars
- 204
- Forks
- 84
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 4
Description
**Describe the bug; what happened?**
When a host closes a breakout room and a participant is automatically returned to the main meeting, the following error is thrown and the meeting ends prematurely for the web client. The following is logged in the developer console:
> Error: Could not return from breakout room because assigned breakout room state could not be retrieved.
**What are the steps to reproduce the issue?**
1. Join a Teams meeting that has breakout rooms enabled.
2. Be assigned to and join a breakout room (the breakout room call becomes the active call in the composite).
3. Have the meeting host close the breakout room.
4. Observe the meeting end and an error message is posted to the console when the automatic return to the main meeting is triggered.
**What behavior did you expect?**
The participant should be silently and seamlessly returned to the main meeting with no error.
**If applicable, provide screenshots:**
(Not applicable — error is a runtime exception)
**In what environment did you see the issue?**
- `@azure/communication-react` npm package version (if applicable): [e.g. 1.31.0]
- `@azure/communication-calling` npm package version (if applicable): [e.g. 1.43.1]
- `@azure/communication-chat` npm package version (if applicable): [e.g. 1.6.0]
- OS & Device: MacOS Tahoe 26.5, Mac Mini M4 Pro
- Browser: Google Chrome (v148.0.7778.179), Apple Safari (v26.5)
**Is there any additional information?**
Root cause: When a participant joins a breakout room, `breakoutRoomJoined()` calls `processNewCall(breakoutRoomCall)`, which sets `this.call` to the breakout room call and re-subscribes events via `subscribeCallEvents()`. The old subscription on the main meeting call is never removed (event listener leak), so when the host closes the breakout room the main meeting call's `assignedBreakoutRooms` event fires and triggers `returnFromBreakoutRoom()`.
At that point, `this.call` is the **breakout room call**, but `returnFromBreakoutRoom()` reads state using `this.call.id`:
```ts
// v1.31.0 — BUG: this.call is the breakout room call, not the main meeting
const callState = this.call?.id ? this.callClient.getState().calls[this.call.id] : undefined;
const assignedBreakoutRoom = callState?.breakoutRooms?.assignedBreakoutRoom;
if (!assignedBreakoutRoom) {
throw new Error(
'Could not return from breakout room because assigned breakout room state could not be retrieved.'
);
}
```
`assignedBreakoutRoom` is tracked on the **main meeting call's** state (confirmed by `@azure/communication-calling`: the data comes from `mainMeetingProperties` on the original call). The breakout room call's state has no `assignedBreakoutRoom`, so `callState?.breakoutRooms?.assignedBreakoutRoom` is `undefined` and the error is thrown.
Note: The fix is already present in the [main branch source](https://github.com/Azure/communication-ui-library/commit/5ab3a4daf2db5b046bcbcce5d7c587f1aac5da50), which queries the SDK's `BreakoutRooms` feature directly on `originCall` instead of going through the stateful client. See: #6037
This fix hasn't yet been released in a published npm package. Could you please cut a patch release to unblock users on v1.31.0?
Contributor guide
Research direction
Start by reviewing commit 5ab3a4daf2db5b046bcbcce5d7c587f1aac5da50 and issue #6037, then inspect the repository’s release process and package metadata. Done means the existing fix is included in a published patch version that unblocks users on v1.31.0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, react, typescript
- Domain
- release
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100