diff --git a/Components/Checkout.tsx b/Components/Checkout.tsx index 07af856..ea13d1c 100644 --- a/Components/Checkout.tsx +++ b/Components/Checkout.tsx @@ -108,6 +108,11 @@ const Checkout = () => { // Track if initial sync from Redux is done const initialSyncDone = useRef(false); + // Track file input refs for resetting (fixes issue where removing file prevents re-upload) + const fileInputRefs = useRef>({ + mainValidId: null, + }); + // Handle clicks outside dropdowns useEffect(() => { const handleClickOutside = (event: MouseEvent) => { @@ -659,6 +664,13 @@ const Checkout = () => { } }; + // Helper function to reset file input element + const resetFileInput = (key: string) => { + if (fileInputRefs.current[key]) { + fileInputRefs.current[key]!.value = ''; + } + }; + const [showCamera, setShowCamera] = useState(false); const [cameraType, setCameraType] = useState<'id'>('id'); const [cameraGuestIndex, setCameraGuestIndex] = useState(undefined); @@ -1570,6 +1582,7 @@ const Checkout = () => {
{ fileInputRefs.current['mainValidId'] = el; }} type="file" accept="image/png,image/jpeg,image/jpg" onChange={(e) => handleFileChange(e, 'id')} @@ -1647,7 +1660,10 @@ const Checkout = () => {