From 25cfed96d69011129b7891192e86671dd1af0b51 Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Mon, 16 Mar 2026 17:33:02 +0800 Subject: [PATCH] update qR scan --- .../FinishedGoodSearch/GoodPickExecutiondetail.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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(() => {