Skip to content

Commit

Permalink
Merge pull request #1347 from glimmerjs/avoid-nested-weakmap
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored Oct 18, 2021
2 parents 0542f62 + 30d57fc commit 8d3bb5c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/@glimmer/runtime/lib/managers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ const HELPER_MANAGERS = new WeakMap<
ManagerFactory<Owner | undefined, HelperManager<unknown> | Helper>
>();

const OWNER_MANAGER_INSTANCES: WeakMap<
Owner,
WeakMap<ManagerFactory<Owner>, unknown>
> = new WeakMap();
const OWNER_MANAGER_INSTANCES: WeakMap<Owner, Map<ManagerFactory<Owner>, unknown>> = new WeakMap();
const UNDEFINED_MANAGER_INSTANCES: WeakMap<ManagerFactory<Owner>, unknown> = new WeakMap();

export type ManagerFactory<O, D extends ManagerDelegate = ManagerDelegate> = (owner: O) => D;
Expand Down Expand Up @@ -107,7 +104,7 @@ function getManagerInstanceForOwner<D extends ManagerDelegate>(
managers = OWNER_MANAGER_INSTANCES.get(owner);

if (managers === undefined) {
managers = new WeakMap();
managers = new Map();
OWNER_MANAGER_INSTANCES.set(owner, managers);
}
}
Expand Down

0 comments on commit 8d3bb5c

Please sign in to comment.