Skip to content

Commit

Permalink
fixes querySourceFeatures types
Browse files Browse the repository at this point in the history
  • Loading branch information
j8seangel committed May 25, 2023
1 parent 9ea24a2 commit 51e35f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/fishing-map/features/datasets/datasets.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const getRelatedDatasetsByType = (
(relatedDataset) =>
relatedDataset.type === datasetType && relatedDataset.id.startsWith(FULL_SUFIX)
)
if (fullDataset && fullDataset.length > 0) {
if (fullDataset!?.length > 0) {
return fullDataset
}
}
Expand Down Expand Up @@ -322,7 +322,7 @@ export const getActiveActivityDatasetsInDataviews = (
) => {
return dataviews.map((dataview) => {
const activeDatasets = (dataview?.config?.datasets || []) as string[]
return dataview.datasets!.filter((dataset) => {
return dataview.datasets!?.filter((dataset) => {
return activeDatasets.includes(dataset.id)
})
})
Expand Down
12 changes: 9 additions & 3 deletions apps/fishing-map/features/map/map-sources.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export const useMapDataviewFeatures = (

const dataviewFeatures = useMemo(() => {
const dataviewsFeature = dataviewsMetadata.map(
({ dataviewsId, metadata, filter = [''], generatorSourceId }) => {
({ dataviewsId, metadata, filter, generatorSourceId }) => {
const sourceLayer = metadata?.sourceLayer || TEMPORALGRID_SOURCE_LAYER_INTERACTIVE
const chunks = metadata?.timeChunks?.chunks.map(({ active, sourceId, quantizeOffset }) => ({
active,
Expand All @@ -273,7 +273,10 @@ export const useMapDataviewFeatures = (
layers: [layer],
})
} else {
features = map.querySourceFeatures(sourceId, { sourceLayer, filter })
features = map.querySourceFeatures(sourceId, {
sourceLayer,
filter: filter as string[],
})
}
}
return {
Expand Down Expand Up @@ -301,7 +304,10 @@ export const useMapDataviewFeatures = (
if (queryMethod === 'render') {
features = map.queryRenderedFeatures(undefined, { layers: [sourceId] })
} else {
features = map.querySourceFeatures(sourceId, { sourceLayer, filter })
features = map.querySourceFeatures(sourceId, {
sourceLayer,
filter: filter as string[],
})
}
}

Expand Down

0 comments on commit 51e35f5

Please sign in to comment.