Open cayleyh opened 8 years ago
As we debounce changes by 100ms this is probably the most likely reason. beforeunload
should take care of that but if the event is not fast enough or browser to strong it's deaded.
I will need to think about this and check it. Thanks for the report. Hopefully we'll find a solution.
+1
+1
@egilkh even a method to force sync + some note in the docs on the debounce interval would be helpful here. I've also encountered issues related to this doing things like deleting a token from localStorage then reloading the entire page.
+1
+1, we are basically switching back to native local storage method because of this
How about to use $interval instead $timeout? Would it help?
When writing an e2e test in Protractor of behaviour that uses ngStorage, there are problems when the test refreshes the page and expects to see updated behaviour based on items persisted to localStorage.
Simple theoretical example is:
Inserting a
browser.sleep(125)
before thebrowser.refresh()
call will cause the test to pass every time. However, according to the protractor docs, this type of thing should not be necessary (http://www.protractortest.org/#/api?view=Protractor.prototype.waitForAngular).Appears that localStorage is not being updated correctly both by the $timeout wait that protractor is supposed to do, and by the
onbeforeunload
handler.There is a related discussion on stackoverflow here: https://stackoverflow.com/questions/28108148/protractor-testing-with-ngstorage/38083164#38083164