chore(AccountSelector): Default to the first item in the account selector when the pre-selected address is not found in the model
There are cases when the AccountSelector can receive invalid address in the input API. In this case we'll default to the first selected item
This commit is contained in:
parent
5fc3b37fbd
commit
663fd91425
|
@ -122,6 +122,11 @@ StatusComboBox {
|
|||
sourceModel: root.model ?? null
|
||||
key: "address"
|
||||
value: d.currentAccountSelection
|
||||
onAvailableChanged: {
|
||||
if (!available) {
|
||||
d.resetSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
|
@ -131,6 +136,15 @@ StatusComboBox {
|
|||
Binding on currentAccountSelection {
|
||||
value: root.selectedAddress || root.currentValue
|
||||
}
|
||||
|
||||
function resetSelection() {
|
||||
currentAccountSelection = ""
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!selectedEntry.available)
|
||||
d.resetSelection()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue