@mmstack/primitives 20.13.1 → 20.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4062,7 +4062,10 @@ const PROXY_CLEANUP_TOKEN = new InjectionToken('@mmstack/primitives:store-proxy-
4062
4062
  providedIn: 'root',
4063
4063
  factory: () => {
4064
4064
  const cache = inject(PROXY_CACHE_TOKEN);
4065
- return new FinalizationRegistry(({ target, prop }) => {
4065
+ return new FinalizationRegistry(({ targetRef, prop }) => {
4066
+ const target = targetRef.deref();
4067
+ if (!target)
4068
+ return;
4066
4069
  const store = cache.get(target);
4067
4070
  if (store)
4068
4071
  store.delete(prop);
@@ -4506,7 +4509,7 @@ function getCachedChild(target, prop, build, cache, cleanupRegistry) {
4506
4509
  const proxy = build();
4507
4510
  const ref = new WeakRef(proxy);
4508
4511
  storeCache.set(prop, ref);
4509
- cleanupRegistry.register(proxy, { target, prop }, ref);
4512
+ cleanupRegistry.register(proxy, { targetRef: new WeakRef(target), prop }, ref);
4510
4513
  return proxy;
4511
4514
  }
4512
4515
  /**
@@ -4861,7 +4864,10 @@ function mutableStore(value, opt) {
4861
4864
  */
4862
4865
  function createStoreContext() {
4863
4866
  const cache = new WeakMap();
4864
- const registry = new FinalizationRegistry(({ target, prop }) => {
4867
+ const registry = new FinalizationRegistry(({ targetRef, prop }) => {
4868
+ const target = targetRef.deref();
4869
+ if (!target)
4870
+ return;
4865
4871
  const entry = cache.get(target);
4866
4872
  if (entry)
4867
4873
  entry.delete(prop);