PolymerElements / app-storage

Data-pipes and specialized services
61 stars 47 forks source link

IE/Edge can't sync local-storage data #110

Open sizuhiko opened 7 years ago

sizuhiko commented 7 years ago

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

mountash commented 7 years ago

It is a Bug in IE