Skip to content

Commit

Permalink
fix: Fix preset filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaclennan committed Oct 2, 2019
1 parent a955944 commit 5bdc42f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/MapView/MapView.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
const filters = {
All: null,
Mining: ['all', ['in', '$preset', 'mining']],
Fishing: ['all', ['in', '$preset', 'fishing']]
Fishing: ['all', ['in', ['$preset'], 'fishing']]
}

export const defaultStory = () => {
Expand Down
1 change: 0 additions & 1 deletion src/MapView/MapViewContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const MapViewContent = (
const intl = useIntl()
const [hovered, setHovered] = useState<?Observation>(null)
const [styleLoaded, setStyleLoaded] = useState(false)
console.log(observations.length)

useImperativeHandle(ref, () => ({
fitBounds: (...args: any) => {
Expand Down
5 changes: 4 additions & 1 deletion src/ViewWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ const createFilter = (filter: Filter | void) => {
if (!Array.isArray(filter) || filter[0] !== 'all' || filter.length < 2)
return () => true
const presetFilter = filter.map(subFilter => {
if (!Array.isArray(subFilter) || subFilter[1] !== '$preset')
if (
!Array.isArray(subFilter) ||
(subFilter[1] !== '$preset' && !isEqual(subFilter[1], ['$preset']))
)
return subFilter
return [subFilter[0], 'categoryId', ...subFilter.slice(2)]
})
Expand Down

0 comments on commit 5bdc42f

Please sign in to comment.