Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use options instead of strigified options #1043

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/react/src/prefabs/PreJoin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function usePreviewTracks(
if (needsCleanup) {
localTracks.forEach((tr) => tr.stop());
} else {
// Only create the tracks if we dont need to clean them up due to a effecRerun.
setTracks(localTracks);
}
}
Expand All @@ -87,13 +88,16 @@ export function usePreviewTracks(
});

return () => {
// In case this is triggered while awaiting for `createLocalTracks`,
// this makes sure, we will stop the tracks after the creation await.
// (yes needsCleanup is passed into this closure by ref and is the same ref as in the
// lock.then closure)
needsCleanup = true;
localTracks.forEach((track) => {
track.stop();
});
};
}, [JSON.stringify(options), onError, trackLock]);

}, [onError, options, trackLock]);
return tracks;
}

Expand Down
Loading