refactor: remove unused isSellMode, setIsSellMode in useSellAsset (#5236)

* refactor: remove unused isSellMode, setIsSellMode in useSellAsset

* rm
This commit is contained in:
vignesh mohankumar 2022-11-16 11:42:56 -05:00 committed by GitHub
parent ef9a59a96b
commit be7e808fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 10 deletions

@ -68,12 +68,10 @@ const ScrollingIndicator = ({ top, show }: SeparatorProps) => (
const Bag = () => {
const { account, provider } = useWeb3React()
const { resetSellAssets, sellAssets, setIsSellMode } = useSellAsset(
({ isSellMode, reset, sellAssets, setIsSellMode }) => ({
isSellMode,
const { resetSellAssets, sellAssets } = useSellAsset(
({ reset, sellAssets }) => ({
resetSellAssets: reset,
sellAssets,
setIsSellMode,
}),
shallow
)
@ -164,9 +162,8 @@ const Bag = () => {
}
const handleCloseBag = useCallback(() => {
setIsSellMode(false)
setBagExpanded({ bagExpanded: false, manualClose: true })
}, [setBagExpanded, setIsSellMode])
}, [setBagExpanded])
const fetchAssets = async () => {
const itemsToBuy = itemsInBag.filter((item) => item.status !== BagItemStatus.UNAVAILABLE).map((item) => item.asset)

@ -4,7 +4,6 @@ import { devtools } from 'zustand/middleware'
import { ListingMarket, ListingWarning, WalletAsset } from '../types'
interface SellAssetState {
isSellMode: boolean
sellAssets: WalletAsset[]
selectSellAsset: (asset: WalletAsset) => void
removeSellAsset: (asset: WalletAsset) => void
@ -12,7 +11,6 @@ interface SellAssetState {
setGlobalExpiration: (expirationTime: number) => void
setAssetListPrice: (asset: WalletAsset, price?: number, marketplace?: ListingMarket) => void
setGlobalMarketplaces: (marketplaces: ListingMarket[]) => void
setIsSellMode: (b: boolean) => void
removeAssetMarketplace: (asset: WalletAsset, marketplace: ListingMarket) => void
addMarketplaceWarning: (asset: WalletAsset, warning: ListingWarning) => void
removeMarketplaceWarning: (asset: WalletAsset, warning: ListingWarning, setGlobalOverride?: boolean) => void
@ -22,7 +20,6 @@ interface SellAssetState {
export const useSellAsset = create<SellAssetState>()(
devtools(
(set) => ({
isSellMode: false,
sellAssets: [],
selectSellAsset: (asset) =>
set(({ sellAssets }) => {
@ -98,7 +95,6 @@ export const useSellAsset = create<SellAssetState>()(
return { sellAssets: assetsCopy }
})
},
setIsSellMode: (isSellMode) => set(() => ({ isSellMode })),
removeAssetMarketplace: (asset, marketplace) => {
set(({ sellAssets }) => {
const assetsCopy = [...sellAssets]