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

fix: sweep reopens bag correctly (#5430)

parent f373a52d
......@@ -168,6 +168,7 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
const removeAssetsFromBag = useBag((state) => state.removeAssetsFromBag)
const itemsInBag = useBag((state) => state.itemsInBag)
const lockSweepItems = useBag((state) => state.lockSweepItems)
const setBagExpanded = useBag((state) => state.setBagExpanded)
const traits = useCollectionFilters((state) => state.traits)
const markets = useCollectionFilters((state) => state.markets)
......@@ -279,6 +280,8 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
const handleSweep = (value: number) => {
if (sortedAssets) {
if (isItemsToggled) {
if (sweepItemsInBag.length === 0 && value > 0) setBagExpanded({ bagExpanded: true })
if (sweepItemsInBag.length < value) {
addAssetsToBag(sortedAssets.slice(sweepItemsInBag.length, value), true)
} else {
......@@ -302,6 +305,7 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
}
if (wishAssets.length > 0) {
if (sweepItemsInBag.length === 0) setBagExpanded({ bagExpanded: true })
addAssetsToBag(wishAssets, true)
}
} else {
......
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