fix(@desktop/wallet): Improving performance when switching accounts
This commit is contained in:
parent
0a3fd7fbfb
commit
19a6ba915c
|
@ -37,7 +37,7 @@ QtObject:
|
||||||
|
|
||||||
proc assetsChanged(self: View) {.signal.}
|
proc assetsChanged(self: View) {.signal.}
|
||||||
proc getAssets*(self: View): QVariant {.slot.} =
|
proc getAssets*(self: View): QVariant {.slot.} =
|
||||||
return newQVariant(self.groupedAccountAssetsModel)
|
return newQVariant(self.assets)
|
||||||
QtProperty[QVariant] assets:
|
QtProperty[QVariant] assets:
|
||||||
read = getAssets
|
read = getAssets
|
||||||
notify = assetsChanged
|
notify = assetsChanged
|
||||||
|
|
|
@ -77,13 +77,14 @@ ColumnLayout {
|
||||||
submodelRoleName: "balances"
|
submodelRoleName: "balances"
|
||||||
delegateModel: SortFilterProxyModel {
|
delegateModel: SortFilterProxyModel {
|
||||||
sourceModel: submodel
|
sourceModel: submodel
|
||||||
filters: ExpressionFilter {
|
filters: FastExpressionFilter {
|
||||||
expression: {
|
expression: {
|
||||||
root.networkFilters
|
root.networkFilters
|
||||||
root.addressFilters
|
root.addressFilters
|
||||||
return root.networkFilters.split(":").includes(chainId+"") &&
|
return root.networkFilters.split(":").includes(model.chainId+"") &&
|
||||||
(!!root.addressFilters ? root.addressFilters.toUpperCase() === account.toUpperCase() : true)
|
(!!root.addressFilters ? root.addressFilters.toUpperCase() === model.account.toUpperCase() : true)
|
||||||
}
|
}
|
||||||
|
expectedRoles: ["chainId", "account"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,15 +109,14 @@ ColumnLayout {
|
||||||
FastExpressionRole {
|
FastExpressionRole {
|
||||||
name: "currentCurrencyBalance"
|
name: "currentCurrencyBalance"
|
||||||
expression: {
|
expression: {
|
||||||
let totalBalance = d.getTotalBalance(model.balances, model.decimals, root.addressFilters, root.networkFilters)
|
|
||||||
if(!model.communityId) {
|
if(!model.communityId) {
|
||||||
return totalBalance * model.marketDetails.currencyPrice.amount
|
return model.currentBalance * model.marketDetails.currencyPrice.amount
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return totalBalance
|
return model.currentBalance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expectedRoles: ["balances", "marketDetails", "decimals", "communityId"]
|
expectedRoles: ["marketDetails", "communityId", "currentBalance"]
|
||||||
},
|
},
|
||||||
FastExpressionRole {
|
FastExpressionRole {
|
||||||
name: "tokenPrice"
|
name: "tokenPrice"
|
||||||
|
@ -135,23 +135,25 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
filters: [
|
filters: [
|
||||||
ExpressionFilter {
|
FastExpressionFilter {
|
||||||
expression: {
|
expression: {
|
||||||
d.controller.settingsDirty
|
d.controller.settingsDirty
|
||||||
return d.tokenIsVisible(model.symbol, model.currentCurrencyBalance)
|
return d.tokenIsVisible(model.symbol, model.currentCurrencyBalance)
|
||||||
}
|
}
|
||||||
|
expectedRoles: ["symbol", "currentCurrencyBalance"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
sorters: [
|
sorters: [
|
||||||
RoleSorter {
|
RoleSorter {
|
||||||
roleName: "isCommunityAsset"
|
roleName: "isCommunityAsset"
|
||||||
},
|
},
|
||||||
ExpressionSorter {
|
FastExpressionSorter {
|
||||||
expression: {
|
expression: {
|
||||||
d.controller.settingsDirty
|
d.controller.settingsDirty
|
||||||
return d.controller.lessThan(modelLeft.symbol, modelRight.symbol)
|
return d.controller.lessThan(modelLeft.symbol, modelRight.symbol)
|
||||||
}
|
}
|
||||||
enabled: d.isCustomView
|
enabled: d.isCustomView
|
||||||
|
expectedRoles: ["symbol"]
|
||||||
},
|
},
|
||||||
RoleSorter {
|
RoleSorter {
|
||||||
roleName: cmbTokenOrder.currentSortRoleName
|
roleName: cmbTokenOrder.currentSortRoleName
|
||||||
|
|
Loading…
Reference in New Issue