diff --git a/opus_submitter/src/components/FileUpload.vue b/opus_submitter/src/components/FileUpload.vue index b4a07a6..a66f25b 100644 --- a/opus_submitter/src/components/FileUpload.vue +++ b/opus_submitter/src/components/FileUpload.vue @@ -248,6 +248,8 @@ const isDragOver = ref(false); const error = ref(""); const files = ref([]); +const isProcessingOCR = ref(false); + // Watch for external changes to modelValue watch( () => props.modelValue, @@ -374,6 +376,12 @@ const isOpusMagnumImage = (file: File): boolean => { }; const processOCR = async (submissionFile: SubmissionFile) => { + while (isProcessingOCR.value) { + console.log("OCR is already processing, waiting 500ms..."); + await new Promise((res) => setTimeout(res, 500)); + } + + isProcessingOCR.value = true; // Find the file in the reactive array to ensure proper reactivity const fileIndex = files.value.findIndex( (f) => f.file === submissionFile.file, @@ -412,6 +420,7 @@ const processOCR = async (submissionFile: SubmissionFile) => { } finally { files.value[fileIndex].ocrProcessing = false; } + isProcessingOCR.value = false; }; const retryOCR = (submissionFile: SubmissionFile) => {