Skip to content

Commit

Permalink
fix: #155 when dev mode, in firefox will cause some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Oct 27, 2023
1 parent 25e8bc7 commit ec3e53e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions packages/agora-rtc-react/src/hooks/useRemoteAudioTracks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export function useRemoteAudioTracks(
useAsyncEffect(async () => {
if (!isUnmountRef.current) {
setError(null);
if (!isConnected) {
setTracks([]);
}
}

if (!Array.isArray(users) || !isConnected) return;
Expand Down Expand Up @@ -130,9 +133,9 @@ export function useRemoteAudioTracks(
user,
mediaType: "audio",
});
nextTracks.current.splice(i, 1);
i--;
}
nextTracks.current.splice(i, 1);
i--;
}
}
if (unsubscribeList.length > 0) {
Expand Down
7 changes: 5 additions & 2 deletions packages/agora-rtc-react/src/hooks/useRemoteVideoTracks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export function useRemoteVideoTracks(
useAsyncEffect(async () => {
if (!isUnmountRef.current) {
setError(null);
if (!isConnected) {
setTracks([]);
}
}

if (!Array.isArray(users) || !isConnected) return;
Expand Down Expand Up @@ -128,9 +131,9 @@ export function useRemoteVideoTracks(
user,
mediaType: "video",
});
nextTracks.current.splice(i, 1);
i--;
}
nextTracks.current.splice(i, 1);
i--;
}
}
if (unsubscribeList.length > 0) {
Expand Down

0 comments on commit ec3e53e

Please sign in to comment.