Skip to content

Commit 95f2229

Browse files
committed
review feedback
1 parent b0cdd3f commit 95f2229

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

x-pack/plugins/maps/public/actions/map_actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ export function fitToDataBounds() {
587587
const b = bounds[i];
588588

589589
//filter out undefined bounds (uses Infinity due to turf responses)
590-
591590
if (
591+
b === null ||
592592
b.minLon === Infinity ||
593593
b.maxLon === Infinity ||
594594
b.minLat === -Infinity ||

x-pack/plugins/maps/public/classes/sources/es_source/es_source.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,15 @@ export class AbstractESSource extends AbstractVectorSource {
161161
let esBounds;
162162
try {
163163
const esResp = await searchSource.fetch();
164-
esBounds = _.get(esResp, 'aggregations.fitToBounds.bounds');
164+
if (!esResp.aggregations.fitToBounds.bounds) {
165+
// aggregations.fitToBounds is empty object when there are no matching documents
166+
return null;
167+
}
168+
esBounds = esResp.aggregations.fitToBounds.bounds;
165169
} catch (error) {
166170
return null;
167171
}
168172

169-
// aggregations.fitToBounds is empty object when there are no matching documents
170-
if (!esBounds) {
171-
return null;
172-
}
173-
174173
const minLon = esBounds.top_left.lon;
175174
const maxLon = esBounds.bottom_right.lon;
176175
return {

0 commit comments

Comments
 (0)