fix: properly await all async operations and add error handling#5
Open
shivv23 wants to merge 5 commits into
Open
fix: properly await all async operations and add error handling#5shivv23 wants to merge 5 commits into
shivv23 wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes all missing
awaitkeywords and unhandled Promise rejections across the codebase. Several async operations were called withoutawait, causing data corruption, silent failures, and unhandled Promise rejections.Critical Bugs Fixed
Menu.tsxdoSave()_getFile()called withoutawait—datawas a Promise object, so.createdwasundefinedMenu.tsxdoSave()_saveFile()called withoutawait— save could silently failNewFile.tsxnewFile()_getFile()and_saveFile()missingawaitFiles.tsxdelete handler_deleteFile()called withoutawaitChanges by File
Menu.tsxdoSave(): Madeasync, addedawaitto both_getFile()and_saveFile(), addedtry/catchdoSaveAs(): Addedawaitbefore_saveFile(), wrapped intry/catchdoPrint(): Madeasync, addedawaittoprinter.print(), addedtry/catchsendEmail(): Madeasync, addedawaittoEmailComposer.open(), addedtry/catchNewFile.tsxnewFile(): Madeasync, addedawaitto_getFile()and_saveFile(), addedtry/catchDashboard.tsxuseEffect: Added.catch()toloadData()call to handle unhandled rejectionshandleOpen(): Converted from.then()chain (with no.catch()) toasync/awaitwithtry/catchawaitto all 5loadData()calls inside async handlers (handleBackup,handleRestore,handleShare,confirmDelete,handleNewFile)Files.tsxeditFile(): Converted from.then()chain (with no.catch()) toasync/awaitwithtry/catchasync, addedawaitto_deleteFile()andloadFiles(), addedtry/catchawaittoloadFiles()calls inhandleBackupandhandleRestoreBackupSuccessModal.tsxconsole.warnto previously emptycatchblock incopyToClipboardVerification
npx tsc --noEmitpasses with zero new errors (only pre-existing@meshkit/ionicmodule stub error)