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 Stefan Dunca
parent 180932b799
commit b9271005cd
7 changed files with 15 additions and 9 deletions

View File

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

View File

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

View File

@ -357,7 +357,7 @@ Item {
// save // save
verify(controlUnderTest.dirty) verify(controlUnderTest.dirty)
controlUnderTest.saveSettings() controlUnderTest.saveSettings(false /* update */)
verify(!controlUnderTest.dirty) verify(!controlUnderTest.dirty)
// load the settings and check BigKitty is still on top // 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") toast.changesDetectedText: manageTokensView.advancedTabVisible ? toast.defaultChangesDetectedText : qsTr("New custom sort order created")
onSaveForLaterClicked: { onSaveForLaterClicked: {
manageTokensView.saveChanges() manageTokensView.saveChanges(false /* update */)
} }
onSaveChangesClicked: { onSaveChangesClicked: {
manageTokensView.saveChanges() manageTokensView.saveChanges(true /* update */)
if (manageTokensView.advancedTabVisible) { if (manageTokensView.advancedTabVisible) {
// don't emit toasts when the Advanced tab is visible // 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 dirty: !!loader.item && loader.item.dirty
readonly property bool advancedTabVisible: tabBar.currentIndex === d.advancedTabIndex readonly property bool advancedTabVisible: tabBar.currentIndex === d.advancedTabIndex
function saveChanges() { function saveChanges(update) {
loader.item.saveSettings() loader.item.saveSettings(update)
} }
function resetChanges() { function resetChanges() {

View File

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

View File

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