-
-
Notifications
You must be signed in to change notification settings - Fork 69
Error retrieving and setting data in different structure #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for your feedback. To be clear: this lib is based on Indeed, value is wrapped in a In all cases, changing that would be a breaking change for all existing apps: all previous stored data would be lost, which is not acceptable. So investigation will be needed to find a solution without breaking. If we're going into interoperability with other libs like |
After some investigation, the main issue to allow the behavior you want is: what if someone stored an object like I can't find a way to know if it's wrapped because of the lib or if it's the real value. Any idea? |
My previous message concerns The |
Current work status:
As mentioned, problem is if |
Fixed in 7.3.0, given some limitations and adaptations described in a special documentation. Direct interoperability by unwrapping the value is considered in #67. |
Thanks for the support, by the way! 😄 |
Hey,
Well, I wanted to share indexedDB data between two different apps. One is in angular but the other is not. My solution was to use LocalForage, given you based your work on it.
But saving a JS object with LocalForage and then using or updating it with this library didn't work, even though the database and table were the same. After some analysis, I noticed the cause to be that you wrap the object in a
value
property.Whether you want your library to be compatible with LocalForage is another discussion, but I guess you may want to handle the errors more precisely.
Setup
Save a JS object, but don't wrap it in another object with the
value
property. Then make LocalStorage get or update this object.Current behavior
getItem
observable returnsnull
.setItem
observable returns the error (I even thought it was related to #47):More precise behavior
getItem
observable throws an error or actually reads the current value.setItem
observable returns a more descriptive error or normalizes the structure to what it should be.The text was updated successfully, but these errors were encountered: