Skip to content

Commit

Permalink
fix(cacheHandlers): Fix loading of array from localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanholzapfel committed Dec 20, 2024
1 parent 7a1a17d commit 0460dc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,7 @@ Needs to be reverted to that:
- fix(cacheHandlers): Fix path creation in localstorage cacheHandler

## [5.0.6]
- fix(cacheHandlers): Take full path in localstorage cacheHandler on array update
- fix(cacheHandlers): Take full path in localstorage cacheHandler on array update

## [5.0.7]
- fix(cacheHandlers): Fix loading of array from localstorage
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stefanholzapfel/lit-state",
"version": "5.0.6",
"version": "5.0.7",
"description": "A reactive state management for Lit",
"publishConfig": {
"access": "public"
Expand Down
3 changes: 1 addition & 2 deletions src/cacheHandlers/localStorage.cacheHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {DeepPartial} from 'ts-essentials';
const LOCALSTORAGE_PREFIX = 'lit-state';

class LocalStorageCacheHandler<State> implements CacheHandler<State> {
// TODO: ensure that this works with array feature
name = 'localstorage';
private localStorageKeys = new Set<string>();

Expand All @@ -25,7 +24,7 @@ class LocalStorageCacheHandler<State> implements CacheHandler<State> {
this.setValue(res, path, +entry.v);
break;
case 'string':
case 'array':
case 'object':
this.setValue(res, path, entry.v);
break;
}
Expand Down

0 comments on commit 0460dc4

Please sign in to comment.