fix: sweep reopens bag correctly (#5430)
This commit is contained in:
parent
f373a52da4
commit
e9dd0c90e0
@ -168,6 +168,7 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
|
|||||||
const removeAssetsFromBag = useBag((state) => state.removeAssetsFromBag)
|
const removeAssetsFromBag = useBag((state) => state.removeAssetsFromBag)
|
||||||
const itemsInBag = useBag((state) => state.itemsInBag)
|
const itemsInBag = useBag((state) => state.itemsInBag)
|
||||||
const lockSweepItems = useBag((state) => state.lockSweepItems)
|
const lockSweepItems = useBag((state) => state.lockSweepItems)
|
||||||
|
const setBagExpanded = useBag((state) => state.setBagExpanded)
|
||||||
|
|
||||||
const traits = useCollectionFilters((state) => state.traits)
|
const traits = useCollectionFilters((state) => state.traits)
|
||||||
const markets = useCollectionFilters((state) => state.markets)
|
const markets = useCollectionFilters((state) => state.markets)
|
||||||
@ -279,6 +280,8 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
|
|||||||
const handleSweep = (value: number) => {
|
const handleSweep = (value: number) => {
|
||||||
if (sortedAssets) {
|
if (sortedAssets) {
|
||||||
if (isItemsToggled) {
|
if (isItemsToggled) {
|
||||||
|
if (sweepItemsInBag.length === 0 && value > 0) setBagExpanded({ bagExpanded: true })
|
||||||
|
|
||||||
if (sweepItemsInBag.length < value) {
|
if (sweepItemsInBag.length < value) {
|
||||||
addAssetsToBag(sortedAssets.slice(sweepItemsInBag.length, value), true)
|
addAssetsToBag(sortedAssets.slice(sweepItemsInBag.length, value), true)
|
||||||
} else {
|
} else {
|
||||||
@ -302,6 +305,7 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wishAssets.length > 0) {
|
if (wishAssets.length > 0) {
|
||||||
|
if (sweepItemsInBag.length === 0) setBagExpanded({ bagExpanded: true })
|
||||||
addAssetsToBag(wishAssets, true)
|
addAssetsToBag(wishAssets, true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user