Use a copy of the value instead of a reference

This commit is contained in:
RMidhunSuresh 2023-08-10 11:31:53 +05:30
parent 4f9eca1a2c
commit da763982ce

View File

@ -47,13 +47,13 @@ export class FilteredMap<K, V> extends BaseObservableMap<K, V> {
*/
_reapplyFilter(silent = false): void {
if (this._filter) {
const oldIncluded = this._included;
this._included = this._included || new Map();
for (const [key, value] of this._source) {
const isIncluded = this._filter(value, key);
const oldIncluded = this._included.get(key);
this._included.set(key, isIncluded);
if (!silent) {
const wasIncluded = oldIncluded ? oldIncluded.get(key) : true;
const wasIncluded = oldIncluded ? oldIncluded : true;
this._emitForUpdate(wasIncluded, isIncluded, key, value);
}
}