diff --git a/package.json b/package.json index 3f2e466..6f87715 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "skooma", - "version": "1.4.0", + "version": "1.4.1", "author": "darkwiiplayer", "license": "Unlicense", "main": "skooma.js", diff --git a/state.js b/state.js index 57aad84..c74c28a 100644 --- a/state.js +++ b/state.js @@ -88,12 +88,12 @@ export class State extends EventTarget { forward(property="value", fallback) { if (!this.#forwardCache) this.#forwardCache = new Map() - const cached = this.#forwardCache.get(property).deref() + const cached = this.#forwardCache.get(property)?.deref() if (cached) { return cached } else { const forwarded = new ForwardState(this, property, fallback) - ref = new Weakref(forwarded) + const ref = new WeakRef(forwarded) this.#forwardCache.set(property, ref) forwardFinalizationRegistry.register(forwarded, [this.#forwardCache, property]) return forwarded