fix: re-request camera stream on retake when tracks are inactive (refs #123)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m20s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 51s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped

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 <noreply@anthropic.com>
This commit is contained in:
Eric Gullickson
2026-02-07 20:26:37 -06:00
parent efc55cd3db
commit 1ff1931864

View File

@@ -151,7 +151,15 @@ export const CameraCapture: React.FC<CameraCaptureProps> = ({
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