fix(RightTabView): revert to using a StackLayout instead of a Loader

in the end it turns out the Loader causes more problems (and even
crashes in some scenarios)
This commit is contained in:
Lukáš Tinkl 2023-12-15 14:23:52 +01:00 committed by Lukáš Tinkl
parent fe3b442155
commit b58612f070
2 changed files with 57 additions and 68 deletions

View File

@ -31,8 +31,7 @@ Item {
function resetView() { function resetView() {
stack.currentIndex = 0 stack.currentIndex = 0
root.currentTabIndex = 0 root.currentTabIndex = 0
if (walletTabBar.currentIndex === 2) historyView.resetView()
mainViewLoader.item.resetView()
} }
function resetStack() { function resetStack() {
@ -129,21 +128,12 @@ Item {
highlighted: checked highlighted: checked
} }
} }
Loader { StackLayout {
id: mainViewLoader id: mainViewLoader
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
sourceComponent: { currentIndex: walletTabBar.currentIndex
switch (walletTabBar.currentIndex) {
case 0: return assetsView
case 1: return collectiblesView
case 2: return historyView
}
}
active: visible
Component {
id: assetsView
AssetsView { AssetsView {
assets: RootStore.assets assets: RootStore.assets
overview: RootStore.overview overview: RootStore.overview
@ -167,9 +157,7 @@ Item {
onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet, onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet,
Constants.walletSettingsSubsection.manageAssets) Constants.walletSettingsSubsection.manageAssets)
} }
}
Component {
id: collectiblesView
CollectiblesView { CollectiblesView {
collectiblesModel: RootStore.collectiblesStore.ownedCollectibles collectiblesModel: RootStore.collectiblesStore.ownedCollectibles
sendEnabled: root.networkConnectionStore.sendBuyBridgeEnabled && !RootStore.overview.isWatchOnlyAccount && RootStore.overview.canSend sendEnabled: root.networkConnectionStore.sendBuyBridgeEnabled && !RootStore.overview.isWatchOnlyAccount && RootStore.overview.canSend
@ -191,10 +179,9 @@ Item {
onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet, onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet,
Constants.walletSettingsSubsection.manageCollectibles) Constants.walletSettingsSubsection.manageCollectibles)
} }
}
Component {
id: historyView
HistoryView { HistoryView {
id: historyView
overview: RootStore.overview overview: RootStore.overview
showAllAccounts: root.showAllAccounts showAllAccounts: root.showAllAccounts
sendModal: root.sendModal sendModal: root.sendModal
@ -206,7 +193,6 @@ Item {
} }
} }
} }
}
CollectibleDetailView { CollectibleDetailView {
collectible: RootStore.collectiblesStore.detailedCollectible collectible: RootStore.collectiblesStore.detailedCollectible
isCollectibleLoading: RootStore.collectiblesStore.isDetailedCollectibleLoading isCollectibleLoading: RootStore.collectiblesStore.isDetailedCollectibleLoading

View File

@ -39,7 +39,10 @@ ColumnLayout {
} }
} }
Component.onCompleted: { onVisibleChanged: {
if (!visible)
return
filterPanelLoader.active = true filterPanelLoader.active = true
if (RootStore.transactionActivityStatus.isFilterDirty) { if (RootStore.transactionActivityStatus.isFilterDirty) {
WalletStores.RootStore.currentActivityFiltersStore.applyAllFilters() WalletStores.RootStore.currentActivityFiltersStore.applyAllFilters()