diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-01-12 20:17:52 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-01-13 16:43:08 -0400 |
commit | 535e941125bc5885f7d96e4654094b5aad11a21b (patch) | |
tree | fef3031c4f5e6df2583ed98959e5f8eb11313501 /src/data/cacheable-object.js | |
parent | 7f691131eee0ca05e43958ca5fe8289550494f25 (diff) |
cacheable-object: mark cache valid / finalization after success
Diffstat (limited to 'src/data/cacheable-object.js')
-rw-r--r-- | src/data/cacheable-object.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/data/cacheable-object.js b/src/data/cacheable-object.js index 2e136bfe..4b354ef7 100644 --- a/src/data/cacheable-object.js +++ b/src/data/cacheable-object.js @@ -45,7 +45,6 @@ export default class CacheableObject { throw new Error(`Expected constructor ${this.name} to provide CacheableObject.propertyDescriptors`); } - this[CacheableObject.constructorFinalized] = true; this[CacheableObject.propertyDependants] = Object.create(null); const propertyDescriptors = this[CacheableObject.propertyDescriptors]; @@ -116,8 +115,6 @@ export default class CacheableObject { return this[CacheableObject.cachedValue][property]; } - this[CacheableObject.cacheValid][property] = true; - const dependencies = Object.create(null); for (const key of expose.dependencies ?? []) { switch (key) { @@ -141,6 +138,7 @@ export default class CacheableObject { : expose.compute(dependencies)); this[CacheableObject.cachedValue][property] = value; + this[CacheableObject.cacheValid][property] = true; return value; }; @@ -176,6 +174,8 @@ export default class CacheableObject { Object.defineProperty(this.prototype, property, definition); } + + this[CacheableObject.constructorFinalized] = true; } static getPropertyDescriptor(property) { |