diff --git a/packages/dataverse/src/derivations/prism/prism.ts b/packages/dataverse/src/derivations/prism/prism.ts index 121119c..e12b342 100644 --- a/packages/dataverse/src/derivations/prism/prism.ts +++ b/packages/dataverse/src/derivations/prism/prism.ts @@ -106,20 +106,20 @@ export class PrismDerivation extends AbstractDerivation { class PrismScope { isPrismScope = true - private _subs: Record = {} + + // NOTE probably not a great idea to eager-allocate all of these objects/maps for every scope, + // especially because most wouldn't get used in the majority of cases. However, back when these + // were stored on weakmaps, they were uncomfortable to inspect in the debugger. + readonly subs: Record = {} readonly effects: Map = new Map() readonly memos: Map = new Map() readonly refs: Map> = new Map() sub(key: string) { - if (!this._subs[key]) { - this._subs[key] = new PrismScope() + if (!this.subs[key]) { + this.subs[key] = new PrismScope() } - return this._subs[key] - } - - get subs() { - return this._subs + return this.subs[key] } cleanupEffects() {