app-storage
app-storage copied to clipboard
IE/Edge can't sync local-storage data
Description
Hi
when listen data-changed from app-localstorage-document, it is not changed data of the tag or event.
IE11/Edge were not set new value to storage at timing of onstorage event.
I checked IE11/Edge on Win10, set break point to this line, this.data is not changed.
I solved my environment followings:
this.listen(window, 'storage', '_dataChanged');
_dataChanged: function(event) {
if (event && event.newValue) {
// Only IE11 set newValue as String, should parse to JSON
var value = (typeof event.newValue === 'string') ? JSON.parse(event.newValue) : event.newValue;
....
}
},
New value is able to get from event.newValue.
see https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onstorage
Expected outcome
when data-changed, be able to get changed value from app-localstorage-document.data or
event.detail.value.
Actual outcome
IE/Edge catch event data-changed, but app-localstorage-document.data or
event.detail.value is not changed.
Browsers Affected
- [ ] Chrome
- [ ] Firefox
- [ ] Safari 9
- [x] Edge
- [x] IE 11
It is a Bug in IE