Return array to prevent fetching again

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-07-02 15:40:27 +05:30
parent ea06d4f88e
commit 89e256e563

View File

@ -35,8 +35,11 @@ export class Disambiguator {
if (value) { if (value) {
if (Array.isArray(value)) { if (Array.isArray(value)) {
value.push(vm); value.push(vm);
return value;
} else { } else {
this._map.set(name, [value, vm]); const array = [value, vm]
this._map.set(name, array);
return array;
} }
} else { } else {
this._map.set(name, vm); this._map.set(name, vm);
@ -46,11 +49,8 @@ export class Disambiguator {
disambiguate(vm) { disambiguate(vm) {
if (!vm.nameChanged) { return; } if (!vm.nameChanged) { return; }
this._handlePreviousName(vm); this._handlePreviousName(vm);
this._updateMap(vm); const value = this._updateMap(vm);
const value = this._map.get(vm.name); value?.forEach((vm) => vm.setDisambiguation(true));
if (Array.isArray(value)) {
value.forEach((vm) => vm.setDisambiguation(true));
}
} }
} }