diff --git a/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx b/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx index 2b04d3b..756657b 100644 --- a/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx +++ b/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx @@ -2840,11 +2840,14 @@ const handleSubmitAllScanned = useCallback(async () => { // ADD THIS: Auto-stop scan when no data available useEffect(() => { - if (isManualScanning && combinedLotData.length === 0) { - console.log("⏹️ No data available, auto-stopping QR scan..."); - handleStopScan(); - } - }, [combinedLotData.length, isManualScanning, handleStopScan]); + return () => { + if (isManualScanning) { + console.log("🧹 Pick execution component unmounting, stopping QR scanner..."); + stopScan(); + resetScan(); + } + }; + }, [isManualScanning, stopScan, resetScan]); // Cleanup effect useEffect(() => {