Skip to content

Commit 1aa72c8

Browse files
authored
fix(state): ensure stable empty array for participant predicates (#2036)
Fixes #2034. Continuation of #2008. We ensure that `empty` data always returns stable array references, as otherwise, `useSyncExternalStore` logs a warning about potential infinite loops.
1 parent 043ee16 commit 1aa72c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/client/src/store/CallState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const createStableParticipantsFilter = (
8686
const empty: StreamVideoParticipant[] = [];
8787
return (participants: StreamVideoParticipant[]) => {
8888
// no need to filter if there are no participants
89-
if (!participants.length) return participants;
89+
if (!participants.length) return empty;
9090

9191
// return a stable empty array if there are no remote participants
9292
// instead of creating an empty one

0 commit comments

Comments
 (0)