From 0460dc4ea9503bcdde9fff2c2aded9dbf01fd854 Mon Sep 17 00:00:00 2001 From: stefanholzapfel Date: Fri, 20 Dec 2024 18:04:52 +0100 Subject: [PATCH] fix(cacheHandlers): Fix loading of array from localstorage --- CHANGELOG.md | 5 ++++- package.json | 2 +- src/cacheHandlers/localStorage.cacheHandler.ts | 3 +-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1f3ee6..8ec3052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 \ No newline at end of file +- fix(cacheHandlers): Take full path in localstorage cacheHandler on array update + +## [5.0.7] +- fix(cacheHandlers): Fix loading of array from localstorage \ No newline at end of file diff --git a/package.json b/package.json index f7c0bf7..91183e8 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/cacheHandlers/localStorage.cacheHandler.ts b/src/cacheHandlers/localStorage.cacheHandler.ts index b9b714b..574ca7d 100644 --- a/src/cacheHandlers/localStorage.cacheHandler.ts +++ b/src/cacheHandlers/localStorage.cacheHandler.ts @@ -5,7 +5,6 @@ import {DeepPartial} from 'ts-essentials'; const LOCALSTORAGE_PREFIX = 'lit-state'; class LocalStorageCacheHandler implements CacheHandler { - // TODO: ensure that this works with array feature name = 'localstorage'; private localStorageKeys = new Set(); @@ -25,7 +24,7 @@ class LocalStorageCacheHandler implements CacheHandler { this.setValue(res, path, +entry.v); break; case 'string': - case 'array': + case 'object': this.setValue(res, path, entry.v); break; }