Commit d3a415ee authored by Jack Short's avatar Jack Short Committed by GitHub

fix: close bag automatically on details (#5296)

* fix: close bag automaticall on details

* auto closing on explore too
parent db9ac38c
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment