fix(wallet): update wallet assets and collectibles order on user action

Add a specific state to the saveSettings action to update the model
by reloading the data.

The previous implementation was using the same save address which
doesn't update. Either in the past there was a side effect that made it
work or it was never working.

Closes #14365
This commit is contained in:
Stefan 2024-04-10 22:38:15 +03:00 committed by Jonathan Rainville
parent d0a3b6ac55
commit 34fd4fc814
7 changed files with 15 additions and 9 deletions

View File

@ -80,7 +80,7 @@ SplitView {
Button {
enabled: showcasePanel.dirty
text: "Save"
onClicked: showcasePanel.saveSettings()
onClicked: showcasePanel.saveSettings(false /* update */)
}
Button {

View File

@ -74,7 +74,7 @@ SplitView {
Button {
enabled: showcasePanel.dirty
text: "Save"
onClicked: showcasePanel.saveSettings()
onClicked: showcasePanel.saveSettings(false /* update */)
}
Button {

View File

@ -357,7 +357,7 @@ Item {
// save
verify(controlUnderTest.dirty)
controlUnderTest.saveSettings()
controlUnderTest.saveSettings(false /* update */)
verify(!controlUnderTest.dirty)
// load the settings and check BigKitty is still on top

View File

@ -68,10 +68,10 @@ SettingsContentBase {
toast.changesDetectedText: manageTokensView.advancedTabVisible ? toast.defaultChangesDetectedText : qsTr("New custom sort order created")
onSaveForLaterClicked: {
manageTokensView.saveChanges()
manageTokensView.saveChanges(false /* update */)
}
onSaveChangesClicked: {
manageTokensView.saveChanges()
manageTokensView.saveChanges(true /* update */)
if (manageTokensView.advancedTabVisible) {
// don't emit toasts when the Advanced tab is visible

View File

@ -42,8 +42,8 @@ Item {
readonly property bool dirty: !!loader.item && loader.item.dirty
readonly property bool advancedTabVisible: tabBar.currentIndex === d.advancedTabIndex
function saveChanges() {
loader.item.saveSettings()
function saveChanges(update) {
loader.item.saveSettings(update)
}
function resetChanges() {

View File

@ -21,9 +21,12 @@ DoubleFlickableWithFolding {
property var getCurrencyAmount: function (balance, symbol) {}
property var getCurrentCurrencyAmount: function(balance) {}
function saveSettings() {
function saveSettings(update) {
let jsonSettings = root.controller.serializeSettingsAsJson()
root.controller.requestSaveSettings(jsonSettings);
if(update) {
root.controller.requestLoadSettings();
}
}
function revert() {

View File

@ -18,9 +18,12 @@ DoubleFlickableWithFolding {
readonly property bool dirty: root.controller.dirty
readonly property bool hasSettings: root.controller.hasSettings
function saveSettings() {
function saveSettings(update) {
let jsonSettings = root.controller.serializeSettingsAsJson()
root.controller.requestSaveSettings(jsonSettings)
if(update) {
root.controller.requestLoadSettings();
}
}
function revert() {