Closed tcchau closed 2 years ago
This is the same issue addressed by https://github.com/pamelafox/lscache/pull/96 I believe ? I didn't merge that yet as there was some debate as to the best code, feel free to take a look and comment. Perhaps I'll have time to merge it and make a released during the holidays.
This is the same issue addressed by #96 I believe ? I didn't merge that yet as there was some debate as to the best code, feel free to take a look and comment. Perhaps I'll have time to merge it and make a released during the holidays.
Yes, the code in the fix for #96 should work. It's the same approach I'm using in my fork. Sorry I didn't catch it as my brief search of the issues didn't seem to match anything.
Sorry for delay, lscache on npm now has the fix!
At least on Chrome, the order that the keys are returned to the caller may change if entries in localStorage are removed. Therefore, the logic of using an indexer to scan the entries in the cache is not guaranteed to exhaustively iterate over all keys.
A safer implementation is to iterate over localStorage without mutating it to create a list of keys to be removed, and then remove them as a second step.