feat(@desktop/wallet): Fetch txs only when opening activity tab (#11360)
closses #11356
This commit is contained in:
parent
b710994bee
commit
00eee836ae
|
@ -183,6 +183,7 @@ QtObject:
|
|||
|
||||
proc updateFilter*(self: Controller) {.slot.} =
|
||||
self.status.setLoadingData(true)
|
||||
self.status.setIsFilterDirty(false)
|
||||
self.model.resetModel(@[])
|
||||
self.eventsHandler.updateSubscribedAddresses(self.addresses)
|
||||
self.status.setNewDataAvailable(false)
|
||||
|
@ -387,7 +388,8 @@ QtObject:
|
|||
QtProperty[QVariant] status:
|
||||
read = getStatus
|
||||
|
||||
|
||||
proc globalFilterChanged*(self: Controller, addresses: seq[string], chainIds: seq[int]) =
|
||||
self.setFilterAddresses(addresses)
|
||||
self.setFilterChains(chainIds)
|
||||
self.updateFilter()
|
||||
self.status.setIsFilterDirty(true)
|
|
@ -21,6 +21,8 @@ QtObject:
|
|||
|
||||
newDataAvailable: bool
|
||||
|
||||
isFilterDirty: bool
|
||||
|
||||
proc setup(self: Status) =
|
||||
self.QObject.setup
|
||||
|
||||
|
@ -55,6 +57,7 @@ QtObject:
|
|||
new(result, delete)
|
||||
|
||||
result.errorCode = backend_activity.ErrorCode.ErrorCodeSuccess
|
||||
result.isFilterDirty = false
|
||||
|
||||
result.setup()
|
||||
|
||||
|
@ -112,3 +115,16 @@ QtObject:
|
|||
QtProperty[bool] newDataAvailable:
|
||||
read = getNewDataAvailable
|
||||
notify = newDataAvailableChanged
|
||||
|
||||
proc isFilterDirtyChanged*(self: Status) {.signal.}
|
||||
|
||||
proc setIsFilterDirty*(self: Status, value: bool) =
|
||||
self.isFilterDirty = value
|
||||
self.isFilterDirtyChanged()
|
||||
|
||||
proc getIsFilterDirty*(self: Status): bool {.slot.} =
|
||||
return self.isFilterDirty
|
||||
|
||||
QtProperty[bool] isFilterDirty:
|
||||
read = getIsFilterDirty
|
||||
notify = isFilterDirtyChanged
|
|
@ -9,7 +9,7 @@ type Filter* = ref object
|
|||
allAddresses*: bool
|
||||
|
||||
proc initFilter*(
|
||||
controller: controller.Controller,
|
||||
controller: controller.Controller
|
||||
): Filter =
|
||||
result = Filter()
|
||||
result.controller = controller
|
||||
|
@ -56,6 +56,5 @@ proc removeAddress*(self: Filter, address: string) =
|
|||
if ind > -1:
|
||||
self.addresses.delete(ind)
|
||||
|
||||
|
||||
proc updateNetworks*(self: Filter) =
|
||||
self.chainIds = self.controller.getEnabledChainIds()
|
||||
|
|
|
@ -40,6 +40,7 @@ QtObject {
|
|||
property var historyTransactions: Global.appIsReady? walletSection.activityController.model : null
|
||||
readonly property bool loadingHistoryTransactions: Global.appIsReady && walletSection.activityController.status.loadingData
|
||||
readonly property bool newDataAvailable: Global.appIsReady && walletSection.activityController.status.newDataAvailable
|
||||
readonly property bool isTransactionFilterDirty: Global.appIsReady && walletSection.activityController.status.isFilterDirty
|
||||
property bool isNonArchivalNode: history ? history.isNonArchivalNode
|
||||
: false
|
||||
property var marketValueStore: TokenMarketValuesStore{}
|
||||
|
@ -186,6 +187,11 @@ QtObject {
|
|||
walletSection.activityController.loadMoreItems()
|
||||
}
|
||||
|
||||
function updateTransactionFilter() {
|
||||
if (isTransactionFilterDirty)
|
||||
walletSection.activityController.updateFilter()
|
||||
}
|
||||
|
||||
function hex2Eth(value) {
|
||||
return globalUtils.hex2Eth(value)
|
||||
}
|
||||
|
|
|
@ -30,6 +30,20 @@ ColumnLayout {
|
|||
|
||||
signal launchTransactionDetail(var transaction)
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
RootStore.updateTransactionFilter()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: RootStore
|
||||
enabled: root.visible
|
||||
function onIsTransactionFilterDirtyChanged() {
|
||||
RootStore.updateTransactionFilter()
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
readonly property bool isInitialLoading: RootStore.loadingHistoryTransactions && transactionListRoot.count === 0
|
||||
|
@ -303,7 +317,7 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
Repeater {
|
||||
model: RootStore.historyTransactions.hasMore || d.isInitialLoading ? 10 : 0
|
||||
model: !noTxs.visible && (RootStore.historyTransactions.hasMore || d.isInitialLoading) ? 10 : 0
|
||||
TransactionDelegate {
|
||||
Layout.fillWidth: true
|
||||
rootStore: RootStore
|
||||
|
|
Loading…
Reference in New Issue