Skip to content

Commit aa14f14

Browse files
[Maps] fix double fetch when filter pill is added (#63024)
* [Maps] fix double fetch when filter pill is added * remove isDataSyncActive * set dataMetaAtStart to null instead of deleting Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent c7b7821 commit aa14f14

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export type DataMeta = Partial<VectorSourceRequestMeta> &
6565

6666
export type DataRequestDescriptor = {
6767
dataId: string;
68-
dataMetaAtStart?: DataMeta;
68+
dataMetaAtStart?: DataMeta | null;
6969
dataRequestToken?: symbol;
7070
data?: object;
7171
dataMeta?: DataMeta;

x-pack/plugins/maps/public/layers/util/data_request.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ export class DataRequest {
2626
}
2727

2828
getMeta(): DataMeta {
29-
return this.hasData()
30-
? _.get(this._descriptor, 'dataMeta', {})
31-
: _.get(this._descriptor, 'dataMetaAtStart', {});
29+
if (this._descriptor.dataMetaAtStart) {
30+
return this._descriptor.dataMetaAtStart;
31+
} else if (this._descriptor.dataMeta) {
32+
return this._descriptor.dataMeta;
33+
} else {
34+
return {};
35+
}
3236
}
3337

3438
hasData(): boolean {

x-pack/plugins/maps/public/reducers/map.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ const updateLayerInList = (state, layerId, attribute, newValue) => {
5757
if (!layerId) {
5858
return state;
5959
}
60+
6061
const { layerList } = state;
6162
const layerIdx = getLayerIndex(layerList, layerId);
63+
if (layerIdx === -1) {
64+
return state;
65+
}
66+
6267
const updatedLayer = {
6368
...layerList[layerIdx],
6469
// Update layer w/ new value. If no value provided, toggle boolean value

0 commit comments

Comments
 (0)