@mmstack/primitives 21.8.1 → 21.8.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.
|
@@ -4212,7 +4212,10 @@ const PROXY_CLEANUP_TOKEN = new InjectionToken('@mmstack/primitives:store-proxy-
|
|
|
4212
4212
|
providedIn: 'root',
|
|
4213
4213
|
factory: () => {
|
|
4214
4214
|
const cache = inject(PROXY_CACHE_TOKEN);
|
|
4215
|
-
return new FinalizationRegistry(({
|
|
4215
|
+
return new FinalizationRegistry(({ targetRef, prop }) => {
|
|
4216
|
+
const target = targetRef.deref();
|
|
4217
|
+
if (!target)
|
|
4218
|
+
return;
|
|
4216
4219
|
const store = cache.get(target);
|
|
4217
4220
|
if (store)
|
|
4218
4221
|
store.delete(prop);
|
|
@@ -4479,7 +4482,7 @@ function getCachedChild(target, prop, build, cache, cleanupRegistry) {
|
|
|
4479
4482
|
const proxy = build();
|
|
4480
4483
|
const ref = new WeakRef(proxy);
|
|
4481
4484
|
storeCache.set(prop, ref);
|
|
4482
|
-
cleanupRegistry.register(proxy, { target, prop }, ref);
|
|
4485
|
+
cleanupRegistry.register(proxy, { targetRef: new WeakRef(target), prop }, ref);
|
|
4483
4486
|
return proxy;
|
|
4484
4487
|
}
|
|
4485
4488
|
/**
|
|
@@ -4834,7 +4837,10 @@ function mutableStore(value, opt) {
|
|
|
4834
4837
|
*/
|
|
4835
4838
|
function createStoreContext() {
|
|
4836
4839
|
const cache = new WeakMap();
|
|
4837
|
-
const registry = new FinalizationRegistry(({
|
|
4840
|
+
const registry = new FinalizationRegistry(({ targetRef, prop }) => {
|
|
4841
|
+
const target = targetRef.deref();
|
|
4842
|
+
if (!target)
|
|
4843
|
+
return;
|
|
4838
4844
|
const entry = cache.get(target);
|
|
4839
4845
|
if (entry)
|
|
4840
4846
|
entry.delete(prop);
|