Fixing a freeze in MapStore on several unsubscribes
For some reason (I could not reproduce this in unit tests alas), the unsubscribe function could be called several times in a row, leading to a complete map freeze. Closes #1736
This commit is contained in:
parent
0d4befc850
commit
e43c4cd5ae
@ -96,6 +96,7 @@ export class MapStore<K, V> extends Map<K, V> implements Readable<Map<K, V>> {
|
|||||||
const unsubscribe = storeByKey.subscribe((newMapValue) => {
|
const unsubscribe = storeByKey.subscribe((newMapValue) => {
|
||||||
if (unsubscribeDeepStore) {
|
if (unsubscribeDeepStore) {
|
||||||
unsubscribeDeepStore();
|
unsubscribeDeepStore();
|
||||||
|
unsubscribeDeepStore = undefined;
|
||||||
}
|
}
|
||||||
if (newMapValue === undefined) {
|
if (newMapValue === undefined) {
|
||||||
set(undefined);
|
set(undefined);
|
||||||
@ -115,6 +116,7 @@ export class MapStore<K, V> extends Map<K, V> implements Readable<Map<K, V>> {
|
|||||||
unsubscribe();
|
unsubscribe();
|
||||||
if (unsubscribeDeepStore) {
|
if (unsubscribeDeepStore) {
|
||||||
unsubscribeDeepStore();
|
unsubscribeDeepStore();
|
||||||
|
unsubscribeDeepStore = undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user