From b57428773a3435240acb11b327a517db1aed8749 Mon Sep 17 00:00:00 2001 From: Luis Perrone Date: Fri, 22 Nov 2024 14:11:34 -0600 Subject: [PATCH] Attempt to fix error showing up by default for scan --- .../hotspot-onboarding/screens/iot/ScanHotspots.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/features/hotspot-onboarding/screens/iot/ScanHotspots.tsx b/src/features/hotspot-onboarding/screens/iot/ScanHotspots.tsx index 856171eb..ab862e7a 100644 --- a/src/features/hotspot-onboarding/screens/iot/ScanHotspots.tsx +++ b/src/features/hotspot-onboarding/screens/iot/ScanHotspots.tsx @@ -123,6 +123,7 @@ const ScanHotspots = () => { } const handleScanPress = useCallback(async () => { + setError(undefined) const shouldScan = !scanning setScanning(shouldScan) await checkPermission() @@ -159,9 +160,12 @@ const ScanHotspots = () => { }, [scannedDevices.length, scanning, startScan, stopScan]) useEffect(() => { - handleScanPress() - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) + // eslint-disable-next-line no-underscore-dangle + if (carouselRef?.current?._activeItem === 1) { + handleScanPress() + } + // eslint-disable-next-line react-hooks/exhaustive-deps, no-underscore-dangle + }, [carouselRef?.current?._activeItem]) const navNext = useCallback( () => carouselRef?.current?.snapToNext(),