Merge pull request #1783 from thecodingmachine/fix_freeze_on_mapstore

Fixing a freeze in MapStore on several unsubscribes
This commit is contained in:
David Négrier 2022-01-28 10:16:42 +01:00 committed by GitHub
commit f602833c73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,6 +96,7 @@ export class MapStore<K, V> extends Map<K, V> implements Readable<Map<K, V>> {
const unsubscribe = storeByKey.subscribe((newMapValue) => {
if (unsubscribeDeepStore) {
unsubscribeDeepStore();
unsubscribeDeepStore = undefined;
}
if (newMapValue === undefined) {
set(undefined);
@ -115,6 +116,7 @@ export class MapStore<K, V> extends Map<K, V> implements Readable<Map<K, V>> {
unsubscribe();
if (unsubscribeDeepStore) {
unsubscribeDeepStore();
unsubscribeDeepStore = undefined;
}
};
});