Skip to content

Commit

Permalink
fix: on sale toggle sortBy (decentraland#1453)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo authored Mar 8, 2023
1 parent d89d0aa commit 9d71fb4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions webapp/src/components/AssetFilters/AssetFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getSectionFromCategory } from '../../modules/routing/search'
import { AssetType } from '../../modules/asset/types'
import { isLandSection } from '../../modules/ui/utils'
import { View } from '../../modules/ui/types'
import { Sections } from '../../modules/routing/types'
import { Sections, SortBy } from '../../modules/routing/types'
import { LANDFilters } from '../Vendor/decentraland/types'
import { Menu } from '../Menu'
import PriceFilter from './PriceFilter'
Expand Down Expand Up @@ -107,7 +107,12 @@ export const AssetFilters = ({

const handleOnSaleChange = useCallback(
(value: boolean) => {
onBrowse({ onlyOnSale: value })
// when toggling off the on sale filter, we need to reset the sortBy to avoid invalid combinations with the on sale sort options
onBrowse(
value
? { onlyOnSale: value }
: { onlyOnSale: value, sortBy: SortBy.NEWEST }
)
},
[onBrowse]
)
Expand Down

0 comments on commit 9d71fb4

Please sign in to comment.