Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 7e15bef

Browse files
author
Kerry
authored
Live location sharing: fix code smells - return useEffect unsub, dont map (#8535)
Signed-off-by: Kerry Archibald <[email protected]>
1 parent aa8e3db commit 7e15bef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/views/beacon/LeftPanelLiveShareWarning.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ const useLivenessMonitor = (liveBeaconIds: BeaconIdentifier[], beacons: Map<Beac
6868
// refresh beacon monitors when the tab becomes active again
6969
const onPageVisibilityChanged = () => {
7070
if (document.visibilityState === 'visible') {
71-
liveBeaconIds.map(identifier => beacons.get(identifier)?.monitorLiveness());
71+
liveBeaconIds.forEach(identifier => beacons.get(identifier)?.monitorLiveness());
7272
}
7373
};
7474
if (liveBeaconIds.length) {
7575
document.addEventListener("visibilitychange", onPageVisibilityChanged);
7676
}
77-
() => {
77+
return () => {
7878
document.removeEventListener("visibilitychange", onPageVisibilityChanged);
7979
};
8080
}, [liveBeaconIds, beacons]);

0 commit comments

Comments
 (0)