You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version Number: v9.2.1-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail:#68727 Email or phone of affected tester (no customers):applausetester+en@applause.expensifail.com Issue reported by: Applause Internal Team Device used: Macbook Pro 2023 / Sequoia 15.2 App Component: Chat Report View
Action Performed:
Access staging.new.expensify.com and sign into a valid account
What changes do you think we should make in order to solve the problem?
We need to add error handling so that if an error occurs during any process, a modal window is displayed and the download is stopped. If necessary, new translations can be added.
To do this, you can do the following:
Add a catch block:
Handle error inside then like we did with other error types, here is updated function:
constvalidateAndResizeFiles=(files: FileObject[],items: DataTransferItem[])=>{// Early return for empty filesif(files.length===0){return;}// Reset collected errors for new validationcollectedErrors.current=[];files.forEach((file,index)=>{originalFileOrder.current.set(file.uri??'',index);});Promise.all(files.map((file,index)=>isValidFile(file,items.at(index),files.length>1).then((isValid)=>(isValid ? file : null)))).then((validationResults)=>{constfilteredResults=validationResults.filter((result): result is FileObject=>result!==null);constpdfsToLoad=filteredResults.filter((file)=>Str.isPDF(file.name??''));constotherFiles=filteredResults.filter((file)=>!Str.isPDF(file.name??''));// Check if we need to convert imagesif(otherFiles.some((file)=>isHeicOrHeifImage(file))){setIsLoaderVisible(true);returnPromise.all(otherFiles.map((file)=>convertHeicImageToJpegPromise(file))).then((convertedImages)=>{constvalidConverted=convertedImages.filter((f): f is FileObject=>f!==null);validConverted.forEach((convertedFile,index)=>{updateFileOrderMapping(otherFiles.at(index),convertedFile);});// Check if we need to resize imagesif(validConverted.some((file)=>(file.size??0)>CONST.API_ATTACHMENT_VALIDATIONS.RECEIPT_MAX_SIZE)){returnPromise.all(validConverted.map((file)=>resizeImageIfNeeded(file))).then((processedFiles)=>{processedFiles.forEach((resizedFile,index)=>{updateFileOrderMapping(validConverted.at(index),resizedFile);});setIsLoaderVisible(false);returnPromise.resolve({processedFiles, pdfsToLoad});});}// No resizing needed, just return the converted imagessetIsLoaderVisible(false);returnPromise.resolve({processedFiles: validConverted, pdfsToLoad});});}// No conversion needed, but check if we need to resize imagesif(otherFiles.some((file)=>(file.size??0)>CONST.API_ATTACHMENT_VALIDATIONS.RECEIPT_MAX_SIZE)){setIsLoaderVisible(true);returnPromise.all(otherFiles.map((file)=>resizeImageIfNeeded(file))).then((processedFiles)=>{processedFiles.forEach((resizedFile,index)=>{updateFileOrderMapping(otherFiles.at(index),resizedFile);});setIsLoaderVisible(false);returnPromise.resolve({processedFiles, pdfsToLoad});});}// No conversion or resizing needed, just return the valid imagesreturnPromise.resolve({processedFiles: otherFiles, pdfsToLoad});}).then(({processedFiles, pdfsToLoad})=>{if(pdfsToLoad.length){validFiles.current=processedFiles;setPdfFilesToRender(pdfsToLoad);}else{if(processedFiles.length>0){setValidFilesToUpload(processedFiles);}if(collectedErrors.current.length>0){constuniqueErrors=Array.from(newSet(collectedErrors.current.map((error)=>JSON.stringify(error)))).map((errorStr)=>JSON.parse(errorStr)asErrorObject);setErrorQueue(uniqueErrors);setCurrentErrorIndex(0);constfirstError=uniqueErrors.at(0);if(firstError){setFileError(firstError.error);if(firstError.fileExtension){setInvalidFileExtension(firstError.fileExtension);}setIsErrorModalVisible(true);}}elseif(processedFiles.length>0){constsortedFiles=sortFilesByOriginalOrder(processedFiles,originalFileOrder.current);proceedWithFilesAction(sortedFiles);resetValidationState();}}}).catch(()=>{setFileError('fileCorrupted');setIsErrorModalVisible(true);setIsLoaderVisible(false);});};
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Activity
melvin-bot commentedon Sep 3, 2025
Triggered auto assignment to @JmillsExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.aadil42 commentedon Sep 3, 2025
hmm. not reproducible.
Screen.Recording.2025-09-04.at.12.mp4
Eskalifer1 commentedon Sep 3, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Infinite loading is seen for HEIC files
What is the root cause of that problem?
We don't have any error handling during file loading, which may cause an error and result in the loader being displayed indefinitely.
Here is the relevant part of the code:
App/src/hooks/useFilesValidation.tsx
Lines 177 to 265 in 60d974c
When we cannot convert file we just reject:
App/src/hooks/useFilesValidation.tsx
Lines 134 to 143 in 60d974c
But dont catch any error, so we get stack
What changes do you think we should make in order to solve the problem?
We need to add error handling so that if an error occurs during any process, a modal window is displayed and the download is stopped. If necessary, new translations can be added.
To do this, you can do the following:
Add a catch block:
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
What alternative solutions did you explore? (Optional)
Additionally we can do the following:
App/src/hooks/useFilesValidation.tsx
Lines 134 to 143 in 60d974c
Handle error inside then like we did with other error types, here is updated function:
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
MariaHCD commentedon Sep 4, 2025
I believe this is a dupe of #68778
melvin-bot commentedon Sep 8, 2025
@JmillsExpensify Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Sep 12, 2025
@JmillsExpensify Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
JmillsExpensify commentedon Sep 16, 2025
Closing as dupe.