Description
In Govt-Billing-React/src/components/NewFile/NewFile.tsx, the newFile function automatically saves the user's current working file before initializing a blank workspace. However, it calls props.store._getFile() synchronously without the await keyword.
Impact
Because local storage operations return a Promise, the data variable holds a pending Promise object instead of the actual file data. When the code attempts to extract (data as any).created, it evaluates to undefined.
This results in the file being re-saved with a corrupted or missing creation timestamp, breaking chronological sorting and potentially causing errors in other parts of the app that expect valid date strings.
Proposed Solution
Convert the newFile arrow function into an async function and apply the await keyword to the props.store._getFile() call so the metadata resolves correctly before the new File object is constructed.
Description
In
Govt-Billing-React/src/components/NewFile/NewFile.tsx, thenewFilefunction automatically saves the user's current working file before initializing a blank workspace. However, it callsprops.store._getFile()synchronously without theawaitkeyword.Impact
Because local storage operations return a Promise, the
datavariable holds a pending Promise object instead of the actual file data. When the code attempts to extract(data as any).created, it evaluates toundefined.This results in the file being re-saved with a corrupted or missing creation timestamp, breaking chronological sorting and potentially causing errors in other parts of the app that expect valid date strings.
Proposed Solution
Convert the
newFilearrow function into anasyncfunction and apply theawaitkeyword to theprops.store._getFile()call so the metadata resolves correctly before the newFileobject is constructed.