From 7e15bef062343c3ff625e46ce1efda085a429c41 Mon Sep 17 00:00:00 2001 From: Kerry Date: Mon, 9 May 2022 10:42:05 +0200 Subject: [PATCH] Live location sharing: fix code smells - return useEffect unsub, dont map (#8535) Signed-off-by: Kerry Archibald --- src/components/views/beacon/LeftPanelLiveShareWarning.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/beacon/LeftPanelLiveShareWarning.tsx b/src/components/views/beacon/LeftPanelLiveShareWarning.tsx index b93d8de1ae..1acca35246 100644 --- a/src/components/views/beacon/LeftPanelLiveShareWarning.tsx +++ b/src/components/views/beacon/LeftPanelLiveShareWarning.tsx @@ -68,13 +68,13 @@ const useLivenessMonitor = (liveBeaconIds: BeaconIdentifier[], beacons: Map { if (document.visibilityState === 'visible') { - liveBeaconIds.map(identifier => beacons.get(identifier)?.monitorLiveness()); + liveBeaconIds.forEach(identifier => beacons.get(identifier)?.monitorLiveness()); } }; if (liveBeaconIds.length) { document.addEventListener("visibilitychange", onPageVisibilityChanged); } - () => { + return () => { document.removeEventListener("visibilitychange", onPageVisibilityChanged); }; }, [liveBeaconIds, beacons]);