@mmstack/primitives 22.8.1 → 22.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.
|
@@ -4249,7 +4249,10 @@ const PROXY_CLEANUP_TOKEN = new InjectionToken('@mmstack/primitives:store-proxy-
|
|
|
4249
4249
|
providedIn: 'root',
|
|
4250
4250
|
factory: () => {
|
|
4251
4251
|
const cache = inject(PROXY_CACHE_TOKEN);
|
|
4252
|
-
return new FinalizationRegistry(({
|
|
4252
|
+
return new FinalizationRegistry(({ targetRef, prop }) => {
|
|
4253
|
+
const target = targetRef.deref();
|
|
4254
|
+
if (!target)
|
|
4255
|
+
return;
|
|
4253
4256
|
const store = cache.get(target);
|
|
4254
4257
|
if (store)
|
|
4255
4258
|
store.delete(prop);
|
|
@@ -4517,7 +4520,7 @@ function getCachedChild(target, prop, build, cache, cleanupRegistry) {
|
|
|
4517
4520
|
const proxy = build();
|
|
4518
4521
|
const ref = new WeakRef(proxy);
|
|
4519
4522
|
storeCache.set(prop, ref);
|
|
4520
|
-
cleanupRegistry.register(proxy, { target, prop }, ref);
|
|
4523
|
+
cleanupRegistry.register(proxy, { targetRef: new WeakRef(target), prop }, ref);
|
|
4521
4524
|
return proxy;
|
|
4522
4525
|
}
|
|
4523
4526
|
/**
|
|
@@ -4874,7 +4877,10 @@ function mutableStore(value, opt) {
|
|
|
4874
4877
|
*/
|
|
4875
4878
|
function createStoreContext() {
|
|
4876
4879
|
const cache = new WeakMap();
|
|
4877
|
-
const registry = new FinalizationRegistry(({
|
|
4880
|
+
const registry = new FinalizationRegistry(({ targetRef, prop }) => {
|
|
4881
|
+
const target = targetRef.deref();
|
|
4882
|
+
if (!target)
|
|
4883
|
+
return;
|
|
4878
4884
|
const entry = cache.get(target);
|
|
4879
4885
|
if (entry)
|
|
4880
4886
|
entry.delete(prop);
|