Skip to content

Commit

Permalink
fix(177): improve useEffect call
Browse files Browse the repository at this point in the history
* add missing dependencies
* add additional effect which stops the scanner when the component unmounts
  • Loading branch information
spaudanjo committed Jun 9, 2022
1 parent c7e1500 commit d0eff23
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/QrReader/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export const useQrReader: UseQrReaderHook = ({
}
});
}
}, [delayBetweenScanAttempts, onResult, video, videoId]);

useEffect(() => {
return () => {
controlsRef.current?.stop();
};
Expand Down

0 comments on commit d0eff23

Please sign in to comment.