Skip to content

Commit 8e99b7b

Browse files
fix: address PR review feedback
- Add meetingState === "joining" to joinRoom skip guard (prevents double-join) - Fix debounce timer: don't push to inlineTimers (avoids hung promise on cleanup) - Fix issue reference: #1226 not #1236 - Update cleanup comment to reflect actual behavior (skip leave during joining) - Preserve "non-promise return" error string (matches existing test REC-005b) - MockDailyProvider: transition state on non-delayed join path Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8f75512 commit 8e99b7b

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

client/src/call/hooks/useCallLifecycle.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ export function useCallLifecycle(callObject, roomUrl, player) {
8888
// corrupting the callObject state for subsequent video stages.
8989
// 150ms is imperceptible to users but longer than any observed transient
9090
// mount, and long enough for the previous leave() to complete.
91-
// See issue #1236.
91+
// See issue #1226.
9292
await new Promise((resolve) => {
93-
inlineTimers.push(setTimeout(resolve, 150));
93+
setTimeout(resolve, 150);
9494
});
9595
if (unmountedRef.current) {
9696
console.log("[VideoCall] Join debounce: component unmounted during delay, skipping join");
9797
return;
9898
}
9999

100100
const meetingState = callObject.meetingState?.();
101-
if (meetingState === "joined-meeting" || joiningMeetingRef.current) {
102-
console.warn("[VideoCall] joinRoom skipped — already in meeting or joining", {
101+
if (meetingState === "joined-meeting" || meetingState === "joining" || joiningMeetingRef.current) {
102+
console.warn("[VideoCall] joinRoom skipped", {
103103
meetingState,
104104
joiningMeetingRef: joiningMeetingRef.current,
105105
});
@@ -225,11 +225,12 @@ export function useCallLifecycle(callObject, roomUrl, player) {
225225
const state = callObject.meetingState?.();
226226

227227
if (
228-
// state === "joining" ||
229228
state === "joined-meeting" ||
230229
state === "loaded"
231230
) {
232-
// only leave if we are in the process of joining or already joined
231+
// Only call leave() once the meeting has fully joined/loaded; we skip
232+
// leave() for state === "joining" (handled below) to avoid forcing a
233+
// leave mid-join.
233234
console.log("[VideoCall] Leaving Daily room", { state });
234235
callObject.leave();
235236
} else if (state === "joining") {

client/src/call/hooks/useCallStartSignaling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function useCallStartSignaling(callObject, recordingEnabled, stageId) {
8484
if (!recordingConfirmedRef.current) {
8585
Sentry.captureMessage("Recording not started for stage", {
8686
level: "error",
87-
extra: { triggeringError: "non-promise return after retry", stageId, trigger },
87+
extra: { triggeringError: "non-promise return", stageId, trigger },
8888
});
8989
}
9090
}, 5000);

playwright/mocks/daily/MockDailyProvider.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ class MockCallObject extends MockEventEmitter {
107107
};
108108
});
109109
}
110+
// Non-delayed join: immediately transition to joined and emit event
111+
if (this._meetingState !== 'joined-meeting') {
112+
this._meetingState = 'joined-meeting';
113+
this.emit('joined-meeting', {});
114+
}
110115
return Promise.resolve();
111116
}
112117

0 commit comments

Comments
 (0)