Open
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
Refers to #38
This PR fixes local persistence reliability in the Ionic React app by making save flows async-safe and null-safe.
Changes
Govt-Billing-React/src/components/Menu/Menu.tsxdoSaveasync and awaited_getFile(...).createdtimestamp and updatedmodified._saveFile(...)indoSaveAs.Govt-Billing-React/src/components/NewFile/NewFile.tsxnewFileasync and awaited_getFile(...).Govt-Billing-React/src/components/Storage/LocalStorage.ts_getFilenull-safe for missing/invalid JSON._getAllFilesto skip invalid entries.Why
Previously,
_getFile(...)promises were used like resolved objects in save flows, which could break metadata handling and lead to inconsistent file persistence.Flow Diagram
flowchart TD subgraph Before A1[Save/New File] --> B1[_getFile returns Promise] B1 --> C1[Read data.created immediately] C1 --> D1[Invalid metadata may be written] end subgraph After A2[Save/New File] --> B2[await _getFile] B2 --> C2{Data valid?} C2 -- Yes --> D2[Preserve created, update modified] D2 --> E2[await _saveFile] C2 -- No --> F2[Show alert/toast and stop safely] end