On iOS, when using setItem on an undefined value, previous items are removed
See original GitHub issueWe found a problem that seems to occur only on iOS. When an undefined value is saved using setItem, previous values saved to keychain are removed. Values added after are saved as they should.
Adding values to keychain
SInfo.setItem('valueThatWillNotAppear', 'thisValueDoesntSave', {});
SInfo.setItem('secondValueThatWillNotAppear', 'thisValueAlsoWontSave', {});
SInfo.setItem('valueThatIsUndefined', undefined, {});
SInfo.setItem('valueThatWillAppear', 'thisValueSaves', {});
SInfo.getAllItems({}).then(values => {
return values;
});
Resulting keychain values
Am I doing something wrong here? I know that I should verify that the value is not undefined but this behavior was definitely not expected.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:5
Top Results From Across the Web
localStorage returns undefined when page is reloaded
But we need to be sure that localStorage.getItem('todo') actually returns a value, that is why I am pleading for a console.log() on it....
Read more >Storage.removeItem() - Web APIs - MDN Web Docs
The removeItem() method of the Storage interface, when passed a key name, will remove that key from the given Storage object if it...
Read more >AsyncStorage - React Native
On iOS, AsyncStorage is backed by native code that stores small values ... Removes an item for a key and invokes a callback...
Read more >localForage - GitHub Pages
Set a value with localStorage: localStorage.setItem('key' ... localforage.clear() will remove every item in the offline store. Use this method with caution.
Read more >LocalStorage and SessionStorage | Web Storage APIs
Data can be stored on the client side by using these APIs. ... setItem("key", "value"); //key and value both should be string or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Holy fucking shit, we just spent 4hours trying to figure out a VERY weird behavior, only to find out that the developer of this fucking library has not even spent the probably 2min that would take to solve this fucking issue. FUCKING FUCK
yea, also spend quite some time what’s happening. Now need to add some surrounded checks.