Select is not properly reseted when selected is a promise
Hi, I have an issue when selected is a promise when trying to clear the select.
Here is a minimal reproduction (base on master) :
<PowerSelect
@selected={{this.selected}}
@onChange={{this.change}}
@options={{this.cities}}
@allowClear={{true}}
as |city|>
{{city}}
</PowerSelect>
https://github.com/romgere/ember-power-select/blob/asyn_issue/tests/dummy/app/templates/playground.hbs
cities = ['Barcelona', 'London', 'New York', 'Porto', 'Coruña', 'Kracow', 'Siena', 'Portland', 'Springfield', 'Tokio']
@tracked _selected = undefined
get selected() {
let s = this._selected === undefined
? resolve(this.cities[2])
: this._selected
return s
}
set selected(v) {
this._selected = v
}
@action
change(v) {
this.selected = v
}
https://github.com/romgere/ember-power-select/blob/asyn_issue/tests/dummy/app/controllers/playground.js
& here is the behavior when trying to clear the select (with clear button, or by settings the value to null "externaly") :
Select is not updated.
I didn't try, but I'm 100% sure it was working on previous power-select version
I'm facing the same issue. Here is the version used: "ember-power-select": "~6.0.1",
:up: me2
Resolved it temporarily by resetting the value via return this.selectedValue ?? Promise.resolve()