From db515d48c1d6b1e725f931029f210967eb280ab3 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 2 Jul 2021 16:12:10 +0530 Subject: [PATCH] Inline flatten method Signed-off-by: RMidhunSuresh --- src/domain/session/rightpanel/disambiguator.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/domain/session/rightpanel/disambiguator.js b/src/domain/session/rightpanel/disambiguator.js index a387a790..f3fa551b 100644 --- a/src/domain/session/rightpanel/disambiguator.js +++ b/src/domain/session/rightpanel/disambiguator.js @@ -3,12 +3,6 @@ export class Disambiguator { this._map = new Map(); } - _flatten(name, array) { - const vm = array.pop(); - vm.setDisambiguation(false); - this._map.set(name, vm); - } - _unDisambiguate(vm, array) { const idx = array.indexOf(vm); if (idx !== -1) { @@ -23,7 +17,11 @@ export class Disambiguator { const value = this._map.get(previousName); if (Array.isArray(value)) { this._unDisambiguate(vm, value); - if (value.length === 1) { this._flatten(previousName, value); } + if (value.length === 1) { + const vm = value[0]; + vm.setDisambiguation(false); + this._map.set(previousName, vm); + } } else { this._map.delete(previousName); }