From 1ff1931864a86127f045b2059ffc824566a09f84 Mon Sep 17 00:00:00 2001 From: Eric Gullickson <16152721+ericgullickson@users.noreply.github.com> Date: Sat, 7 Feb 2026 20:26:37 -0600 Subject: [PATCH] fix: re-request camera stream on retake when tracks are inactive (refs #123) The retake button failed because the stream tracks could become inactive during the crop phase, but handleRetake never re-acquired the camera. Co-Authored-By: Claude Opus 4.6 --- .../shared/components/CameraCapture/CameraCapture.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/shared/components/CameraCapture/CameraCapture.tsx b/frontend/src/shared/components/CameraCapture/CameraCapture.tsx index c6bd8e1..d33cad0 100644 --- a/frontend/src/shared/components/CameraCapture/CameraCapture.tsx +++ b/frontend/src/shared/components/CameraCapture/CameraCapture.tsx @@ -151,7 +151,15 @@ export const CameraCapture: React.FC = ({ setCapturedFile(null); setCapturedImageSrc(null); setCaptureState('viewfinder'); - }, [capturedImageSrc]); + + // Re-request camera if stream tracks are no longer active + const isStreamActive = stream?.getVideoTracks().some( + (track) => track.readyState === 'live' + ); + if (!isStreamActive) { + requestPermission(); + } + }, [capturedImageSrc, stream, requestPermission]); const handleCropReset = useCallback(() => { // Just reset crop area, keep the captured image