Skip to content

Commit

Permalink
fix: set isAlreadyLoaded flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcase committed Mar 3, 2025
1 parent 0557d99 commit b4d34ed
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ui/components/Scanner/Scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const Scanner = forwardRef(
useState<IdentifierShortDetails | null>(null);
const isHandlingQR = useRef(false);
const [isTransitioning, setIsTransitioning] = useState(false);
const [isAlreadyLoaded, setIsAlreadyLoaded] = useState(false);

useEffect(() => {
if (platforms.includes("mobileweb")) {
Expand Down Expand Up @@ -196,6 +197,7 @@ const Scanner = forwardRef(
} else {
await stopScan();
}
setIsAlreadyLoaded(true);
};
onLoad();
}, [
Expand All @@ -214,6 +216,7 @@ const Scanner = forwardRef(
setIsTransitioning(false);
};

if (!isAlreadyLoaded) return;
handleCameraChange();
}, [cameraDirection]);

Expand Down

0 comments on commit b4d34ed

Please sign in to comment.