fix: close bag automatically on details (#5296)
* fix: close bag automaticall on details * auto closing on explore too
This commit is contained in:
parent
db9ac38c64
commit
d3a415ee96
@ -6,7 +6,8 @@ import { useLoadNftBalanceQuery } from 'graphql/data/nft/NftBalance'
|
||||
import { AssetDetails } from 'nft/components/details/AssetDetails'
|
||||
import { AssetDetailsLoading } from 'nft/components/details/AssetDetailsLoading'
|
||||
import { AssetPriceDetails } from 'nft/components/details/AssetPriceDetails'
|
||||
import { Suspense, useMemo } from 'react'
|
||||
import { useBag } from 'nft/hooks'
|
||||
import { Suspense, useEffect, useMemo } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import styled from 'styled-components/macro'
|
||||
|
||||
@ -66,9 +67,14 @@ const Asset = () => {
|
||||
const AssetPage = () => {
|
||||
const { tokenId, contractAddress } = useParams()
|
||||
const { account } = useWeb3React()
|
||||
const setBagExpanded = useBag((state) => state.setBagExpanded)
|
||||
useLoadDetailsQuery(contractAddress, tokenId)
|
||||
useLoadNftBalanceQuery(account, contractAddress, tokenId)
|
||||
|
||||
useEffect(() => {
|
||||
setBagExpanded({ bagExpanded: false, manualClose: false })
|
||||
}, []) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<Suspense fallback={<AssetDetailsLoading />}>
|
||||
<Asset />
|
||||
|
@ -2,6 +2,8 @@ import { Trace } from '@uniswap/analytics'
|
||||
import { PageName } from '@uniswap/analytics-events'
|
||||
import Banner from 'nft/components/explore/Banner'
|
||||
import TrendingCollections from 'nft/components/explore/TrendingCollections'
|
||||
import { useBag } from 'nft/hooks'
|
||||
import { useEffect } from 'react'
|
||||
import styled from 'styled-components/macro'
|
||||
|
||||
const ExploreContainer = styled.div`
|
||||
@ -20,6 +22,12 @@ const ExploreContainer = styled.div`
|
||||
`
|
||||
|
||||
const NftExplore = () => {
|
||||
const setBagExpanded = useBag((state) => state.setBagExpanded)
|
||||
|
||||
useEffect(() => {
|
||||
setBagExpanded({ bagExpanded: false, manualClose: false })
|
||||
}, []) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<>
|
||||
<Trace page={PageName.NFT_EXPLORE_PAGE} shouldLogImpression>
|
||||
|
Loading…
Reference in New Issue
Block a user