Skip to content

Commit

Permalink
handle crash when no selfReportedInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
j8seangel committed Jul 30, 2024
1 parent 1a6f285 commit eb604d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/fishing-map/features/search/search.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ export const fetchVesselSearchThunk = createAsyncThunk(

const datasetConfig = {
endpoint: EndpointId.VesselSearch,
datasetId: dataset.id,
datasetId: dataset?.id,
params: [],
query: [
{ id: 'includes', value: ['MATCH_CRITERIA', 'OWNERSHIP'] },
{ id: 'datasets', value: datasets.map((d) => d.id) },
{ id: 'datasets', value: datasets.map((d) => d?.id) },
{
id: advancedQuery ? 'where' : 'query',
value: encodeURIComponent(advancedQuery || query || ''),
Expand All @@ -143,7 +143,7 @@ export const fetchVesselSearchThunk = createAsyncThunk(
// Not removing duplicates for GFWStaff so they can compare other VS fishing vessels
const uniqSearchResults = gfwUser
? searchResults.entries
: uniqBy(searchResults.entries, (r) => r.selfReportedInfo[0].id)
: uniqBy(searchResults.entries, (r) => r.selfReportedInfo[0]?.id)

const vesselsWithDataset = uniqSearchResults.flatMap((vessel) => {
if (!vessel) return []
Expand Down

0 comments on commit eb604d6

Please sign in to comment.