From 130c02295627314bc3a0e3f08101d807af8a0184 Mon Sep 17 00:00:00 2001 From: ultish Date: Thu, 17 Mar 2022 16:33:05 +1100 Subject: [PATCH] fix for reverting a change back to original promise When @selected is a promise initially, you update it to a non-promise value, and then revert the change back to the original promise value, EPS was ignoring the change as it still held a reference to _lastSelectedPromise. --- addon/components/power-select.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addon/components/power-select.ts b/addon/components/power-select.ts index 515b48c81..4bf777d5b 100644 --- a/addon/components/power-select.ts +++ b/addon/components/power-select.ts @@ -375,6 +375,11 @@ export default class PowerSelect extends Component { } }); } else { + if (this._lastSelectedPromise) { + // no longer using a promise + removeObserver(this._lastSelectedPromise, 'content', this, this._selectedObserverCallback); + this._lastSelectedPromise = undefined; + } this._resolvedSelected = undefined; // Don't highlight args.selected array on multi-select if (!Array.isArray(this.args.selected)) {