Skip to content

Commit 16f9cb3

Browse files
add missing deps
1 parent 8f8fe14 commit 16f9cb3

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

docs/how-to/client/managing-devices.mdx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,25 @@ function RoomScreen() {
280280
const [queryMicrophone, requestMicrophone] = useMicrophonePermissions(); // [!code highlight]
281281
const { initializeDevices } = useInitializeDevices(); // [!code highlight]
282282

283-
const setup = async () => {
284-
let cam = await queryCamera();
285-
let mic = await queryMicrophone();
286-
287-
if (cam !== "granted") cam = await requestCamera();
288-
if (mic !== "granted") mic = await requestMicrophone();
283+
useEffect(() => {
284+
const setup = async () => {
285+
let cam = await queryCamera();
286+
let mic = await queryMicrophone();
289287

290-
if (cam === "granted" && mic === "granted") {
291-
await initializeDevices(); // [!code highlight]
292-
}
293-
};
288+
if (cam !== "granted") cam = await requestCamera();
289+
if (mic !== "granted") mic = await requestMicrophone();
294290

295-
useEffect(() => {
291+
if (cam === "granted" && mic === "granted") {
292+
await initializeDevices(); // [!code highlight]
293+
}
294+
};
296295
setup();
297-
}, []);
296+
}, [
297+
queryCamera,
298+
requestCamera,
299+
queryMicrophone,
300+
requestMicrophone,
301+
initializeDevices,
302+
]);
298303
}
299304
```

0 commit comments

Comments
 (0)