From c373798b8e3a46d34f253dc6956be141cb4db2a1 Mon Sep 17 00:00:00 2001 From: voluntas Date: Wed, 22 Nov 2023 23:50:45 +0900 Subject: [PATCH] =?UTF-8?q?useExhaustiveDependencies=20=E3=82=92=E6=9C=89?= =?UTF-8?q?=E5=8A=B9=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- biome.json | 3 --- src/components/AlertMessages.tsx | 2 +- src/components/Video/Video.tsx | 5 +++-- src/pages/devtools.tsx | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/biome.json b/biome.json index 933a4a0f..7b80385a 100644 --- a/biome.json +++ b/biome.json @@ -7,9 +7,6 @@ "enabled": true, "rules": { "all": true, - "correctness": { - "useExhaustiveDependencies": "off" - }, "style": { "useNamingConvention": "off" }, diff --git a/src/components/AlertMessages.tsx b/src/components/AlertMessages.tsx index 9e5d7d82..56e0931d 100644 --- a/src/components/AlertMessages.tsx +++ b/src/components/AlertMessages.tsx @@ -14,7 +14,7 @@ const Reconnect: React.FC = () => { } useEffect(() => { dispatch(reconnectSora()) - }, []) + }, [dispatch]) return ( diff --git a/src/components/Video/Video.tsx b/src/components/Video/Video.tsx index f0e7d752..73bed4f3 100644 --- a/src/components/Video/Video.tsx +++ b/src/components/Video/Video.tsx @@ -15,6 +15,7 @@ const VideoElement: React.FC = (props) => { const { displayResolution, stream, mute, audioOutput, setHeight } = props const videoRef = useRef(null) const videoSize = getVideoSizeByResolution(displayResolution) + useEffect(() => { const resizeObserver = new ResizeObserver((entries: ResizeObserverEntry[]) => { entries.filter((entry) => { @@ -30,7 +31,7 @@ const VideoElement: React.FC = (props) => { return () => { resizeObserver.disconnect() } - }, []) + }, [setHeight, audioOutput, stream]) useEffect(() => { if (videoRef.current && mute) { @@ -63,7 +64,7 @@ const VideoElement: React.FC = (props) => { } else if (videoRef.current && stream === null) { videoRef.current.srcObject = null } - }, [stream]) + }, [stream, audioOutput]) if (audioOutput && videoRef.current?.setSinkId && stream && stream.getAudioTracks().length > 0) { videoRef.current.setSinkId(audioOutput) diff --git a/src/pages/devtools.tsx b/src/pages/devtools.tsx index 3edd3e68..be1c76af 100644 --- a/src/pages/devtools.tsx +++ b/src/pages/devtools.tsx @@ -19,7 +19,7 @@ const Devtools: React.FC = () => { return () => { dispatch(disconnectSora()) } - }, []) + }, [dispatch]) return ( <>