This repository has been archived by the owner on Nov 19, 2020. It is now read-only.
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.
Fixes Save JSON state in local storage #120. Saves current version of data before window/tab is
closed by the its url from where it was fetched earlier. And check
before fetching a data if it exists on local stroge. Finally clear the
data if it is save successfully.
Refactors api.service.
Some discussion
Actually clearing doesn't help much since even you don't touch the record after saving remotely, it will be saved locally on window unload. It only works when you open this saved record again in another tab without closing. I'd like to know if we should keep the copy of last remotely saved data and compare it with the current one on window unload before saving the current one to local storage.
Although it's not in the PR yet but I think we should ask if user wants to load local copy or remote when local copy exists. For this one @StellaCh might help to figure out if we want to load local by default and have a reload button for re-fetch or ask to save locally when closing the tab or ask to load local save on the start