fix: Update account only when networks did change (#16229)

This commit is contained in:
Cuteivist 2024-09-04 06:32:07 +02:00 committed by GitHub
parent f1904d9ef8
commit 186b5f8798
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -258,14 +258,18 @@ ColumnLayout {
multiSelection: true
selection: d.preferredSharingNetworksArray
property string initialSelection
onSelectionChanged: {
if (selection !== d.preferredSharingNetworksArray) {
d.preferredSharingNetworksArray = selection
}
}
control.popup.onOpened: initialSelection = JSON.stringify(selection)
control.popup.onClosed: {
if (!!root.account) {
if (!!root.account && initialSelection !== JSON.stringify(selection)) {
root.walletStore.updateWalletAccountPreferredChains(root.account.address, d.preferredSharingNetworksArray.join(":"))
}
}

View File

@ -307,6 +307,8 @@ StatusModal {
NetworkSelectPopup {
id: selectPopup
property string initialSelection
x: editButton.width - width
y: editButton.height + 2
@ -323,8 +325,10 @@ StatusModal {
d.preferredChainIdsArray = selection
}
onOpened: initialSelection = JSON.stringify(selection)
onClosed: {
root.updatePreferredChains(root.selectedAccount.address, d.preferredChainIds)
if (initialSelection !== JSON.stringify(selection))
root.updatePreferredChains(root.selectedAccount.address, d.preferredChainIds)
}
}
}