fix: Reset collectible details after exiting details page (#16231)

This commit is contained in:
Cuteivist 2024-09-04 06:29:31 +02:00 committed by GitHub
parent 16d0df694c
commit f1904d9ef8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 1 deletions

View File

@ -112,6 +112,10 @@ QtObject:
error "error fetching collectible details: ", response.error
return
proc resetDetailedCollectible*(self: Controller) {.slot.} =
self.detailedEntry = newCollectibleDetailsEmptyEntry()
self.detailedEntryChanged()
proc setupEventHandlers(self: Controller) =
self.eventsHandler.onGetCollectiblesDetailsDone(proc (jsonObj: JsonNode) =
self.processGetCollectiblesDetailsResponse(jsonObj)

View File

@ -297,7 +297,12 @@ Item {
footer: WalletFooter {
id: footer
readonly property bool isHoldingSelected: !!walletStore.currentViewedCollectible && walletStore.currentViewedHoldingID !== ""
readonly property bool isHoldingSelected: {
if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.currentTabIndex !== WalletLayout.RightPanelSelection.Collectibles) {
return false
}
return !!walletStore.currentViewedCollectible && walletStore.currentViewedHoldingID !== ""
}
readonly property bool isCommunityCollectible: !!walletStore.currentViewedCollectible ? walletStore.currentViewedCollectible.communityId !== "" : false
readonly property bool isOwnerCommunityCollectible: isCommunityCollectible ? (walletStore.currentViewedCollectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) : false

View File

@ -109,6 +109,10 @@ QtObject {
walletSection.collectibleDetailsController.getDetailedCollectible(chainId, contractAddress, tokenId)
}
function resetDetailedCollectible() {
walletSection.collectibleDetailsController.resetDetailedCollectible()
}
function hasNFT(ownerAddress, chainId, tokenId, tokenAddress) {
const uid = getUidForData(tokenId, tokenAddress, chainId)
ownerAddress = ownerAddress.toLowerCase()

View File

@ -356,6 +356,7 @@ RightTabBaseView {
onVisibleChanged: {
if (!visible) {
RootStore.resetCurrentViewedHolding(Constants.TokenType.ERC721)
RootStore.collectiblesStore.resetDetailedCollectible()
}
}