Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions x-pack/plugins/maps/public/classes/sources/es_source/es_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,12 @@ export class AbstractESSource extends AbstractVectorSource {
const esResp = await searchSource.fetch();
esBounds = _.get(esResp, 'aggregations.fitToBounds.bounds');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than keep hiding the root-cause, could we remove use of lodash here?

 esBonds = aggregations.fitToBounds.bounds ? aggregations.fitToBounds.bounds : null;

or

if (!aggregations.fitToBounds.bounds) {
    return null;
} 
esBounds = aggregations.fitToBounds.bounds;

which helps clarity

} catch (error) {
esBounds = {
top_left: {
lat: 90,
lon: -180,
},
bottom_right: {
lat: -90,
lon: 180,
},
};
return null;
}

// aggregations.fitToBounds is empty object when there are no matching documents
if (!esBounds) {
return null;
}

const minLon = esBounds.top_left.lon;
Expand Down