Skip to content

Commit

Permalink
fix: component ConsumerCloner doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
woody146 committed Nov 3, 2023
1 parent 557dc4a commit 4f9bda2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions examples/rooms/src/components/Consumer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export function Consumers({
onConnected: () => setLog('connected'),
});
setTransport(transport);
if (!display) {
// auto get producers for consumer cloner
loadProducers();
}
};

const loadProducers = async () => {
Expand Down Expand Up @@ -136,9 +140,11 @@ export function Consumers({
}, []);

useEffect(() => {
const fail = Object.values(success).find((item) => item === false);
if (!fail) {
onSuccess && onSuccess();
if (Object.keys(success).length > 0) {
const item = Object.values(success).find((item) => item === false);
if (item === undefined) {
onSuccess && onSuccess();
}
}
}, [success]);

Expand Down

0 comments on commit 4f9bda2

Please sign in to comment.