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
The current logic triggers the toast message if result is falsy or if accession and/or application is undefined or null. However, if result is an object simply missing COVER PAGE sheet, or being an empty file (same to .json if missing admin property), the current code will NOT trigger the toast. Instead, it will attempt to destructure accession and application from result, and they will be undefined.
This leads to unexpected behavior where file being accepted but no error message but also confirmation and Next button is disabled, since the toast condition is tied to the truthiness of result, not its individual properties.
A more robustic logic should be
#// Xlsx file
try {
const result = await api.transfer.parseXlsxFileList(fileList);
if (result && result.accession && result.application) {
const { accession, application, folders } = result;
setAccession(accession);
setApplication(application);
setFoldersToProcess(folders);
} else {
toast.error(Toast, {
data: {
title: "Missing accession and/or application number",
message:
"Your file list (ARS 662) is missing an accession and/or application number. Please add this information to the ‘Cover Page’ tab in the file list and save it, then try uploading the file again.",
},
});
}
} catch (error) {
console.error("Error parsing the file list:", error);
// error message is subject to change
toast.error("An error occurred while processing the file. Please ensure file content adheres to the required structure.");
}
The text was updated successfully, but these errors were encountered:
Please refer to: desktop/src/renderer/src/pages/transfers/LanTransfer.tsx
The current logic triggers the toast message if
result
is falsy or ifaccession
and/orapplication
isundefined
ornull
. However, ifresult
is an object simply missing COVER PAGE sheet, or being an empty file (same to .json if missing admin property), the current code will NOT trigger the toast. Instead, it will attempt to destructure accession and application from result, and they will beundefined
.This leads to unexpected behavior where file being accepted but no error message but also confirmation and Next button is disabled, since the toast condition is tied to the truthiness of
result
, not its individual properties.A more robustic logic should be
The text was updated successfully, but these errors were encountered: