Skip to content

BUG: On $reset if load the same values the Local Storage is clear. #281

@pdorgambide

Description

@pdorgambide

Bug: Browser storage mantein clear when $localstorage.$reset and try to load the same data.
$localstorage.$reset($localstorage); // Brower Local Storage are empty

The cause: On $reset the _last$storage variable is not clear and this make that on $apply the conditon always is true:
if (!angular.equals($storage, _last$storage))

Fix (suggested):

                  $reset: function(items) {
                            for (var k in $storage) {
                                '$' === k[0] || (delete $storage[k] && webStorage.removeItem(storageKeyPrefix + k));
                            }
                            _last$storage={}; 
                            return $storage.$default(items);
                        },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions