Skip to content

Commit

Permalink
Only calls rehydrate if old and new values differ (#16)
Browse files Browse the repository at this point in the history
See #9 

IE 11 seems to get stuck in an infinite loop of `storage` events sometimes. By only rehydrating if the old and new values aren't the same, this problems seems to be fixed *yaay*
  • Loading branch information
irisSchaffer authored and rt2zz committed Nov 20, 2017
1 parent 05f8285 commit 273739e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = function(persistor, config){
var keyspace = e.key.substr(keyPrefix.length)
if(whitelist && whitelist.indexOf(keyspace) === -1){ return }
if(blacklist && blacklist.indexOf(keyspace) !== -1){ return }
if(e.oldValue === e.newValue){ return }

var statePartial = {}
statePartial[keyspace] = e.newValue
Expand Down

0 comments on commit 273739e

Please sign in to comment.