From dd143cc8485ea47094906695d9e2249ef3bf28d6 Mon Sep 17 00:00:00 2001 From: Daniel Kucal Date: Wed, 27 Dec 2017 19:17:08 +0100 Subject: [PATCH] fix(CacheItem): fix initial value in case of falsy value, v1.3.3 --- package-lock.json | 2 +- package.json | 2 +- src/decorator/cache-item.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 45b8237..d8574dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ngx-store", - "version": "1.3.2", + "version": "1.3.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4e2527f..ac57784 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-store", - "version": "1.3.2", + "version": "1.3.3", "main": "./dist/index", "typings": "./dist/index", "description": "Angular decorators to automagically keep variables in HTML5 LocalStorage, SessionStorage, cookies; injectable services for managing and listening to data changes and a bit more.", diff --git a/src/decorator/cache-item.ts b/src/decorator/cache-item.ts index 0f01d8f..8720564 100644 --- a/src/decorator/cache-item.ts +++ b/src/decorator/cache-item.ts @@ -47,7 +47,8 @@ export class CacheItem implements CacheItemInterface { this.initializedTargets.add(this.currentTarget); let readValue = this.readValue(config); let savedValue = (readValue !== null) ? readValue : value; - let proxy = this.getProxy(savedValue, config) || value; + let proxy = this.getProxy(savedValue, config); + proxy = (proxy !== null) ? proxy : value; debug.log('initial value for ' + this.key + ' in ' + this.currentTarget.constructor.name, proxy); this.utilities.forEach(utility => utility.set(this._key, savedValue, config)); return proxy;