Feat/improved local and session storage #1003
Merged
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.
https://pikax.me/vue-composable/composable/storage/localStorage.html
In current documentation,
removefunction is described as an equivalent tostorage.value = undefined, but it's false.When we set starage.value = undefined, this undefined is being stored in localStorage as 'undefined' (string), which lead to issues when reloading the app.
Another issue is when we pass a
refas adefaultValue(which is acceptable), then therefitself (object) is saved into localStorage, rather that it's value.There's also a thing that is missing for me personally and that is instant save into storage. Debounce is great but when I tried to use your library to store accessToken in localStorage I had an issue. In some requests the key was missing, so I believe that an option to fully sync storage with ref would be nice.
I also don't see any reason to provide
setSyncfunction in sessionStorage, when it's useless.I've fixed those and few other things in this pull req