From 141394c9a24d8ed427c2484b302a2449d81ff3d8 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 15 Jul 2019 18:15:28 +0200 Subject: [PATCH 1/6] dont update embeddables on changes in disabled filters --- .../dashboard/dashboard_app_controller.tsx | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx index ec6755e95c323..c65735dac529b 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx @@ -82,6 +82,23 @@ import { DashboardAppScope } from './dashboard_app'; import { VISUALIZE_EMBEDDABLE_TYPE } from '../visualize/embeddable'; import { convertSavedDashboardPanelToPanelState } from './lib/embeddable_saved_object_converters'; +function areFilterChangesFetchRelevant(oldFilters: Filter[], newFilters: Filter[]) { + if (oldFilters.length !== newFilters.length) { + return true; + } + + for (let i = 0; i < oldFilters.length; i++) { + const oldFilter = oldFilters[i]; + const newFilter = newFilters[i]; + + if (oldFilter.meta.disabled !== newFilter.meta.disabled) { + return true; + } + } + + return false; +} + export class DashboardAppController { // Part of the exposed plugin API - do not remove without careful consideration. appStatus: { @@ -361,7 +378,15 @@ export class DashboardAppController { const refreshDashboardContainer = () => { const changes = getChangesFromAppStateForContainerState(); - if (changes && dashboardContainer) { + if ( + changes && + dashboardContainer && + !( + changes.filters && + Object.keys(changes).length === 1 && + !areFilterChangesFetchRelevant($scope.model.filters, changes.filters) + ) + ) { dashboardContainer.updateInput(changes); } }; @@ -675,9 +700,10 @@ export class DashboardAppController { // update root source when filters update const updateSubscription = queryFilter.getUpdates$().subscribe({ next: () => { + const oldFilters = $scope.model.filters; $scope.model.filters = queryFilter.getFilters(); dashboardStateManager.applyFilters($scope.model.query, $scope.model.filters); - if (dashboardContainer) { + if (dashboardContainer && areFilterChangesFetchRelevant(oldFilters, $scope.model.filters)) { dashboardContainer.updateInput({ filters: $scope.model.filters }); } }, From a8729f76fa552895d3e5c76e5edc59d4b7a0bcd5 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 15 Jul 2019 18:27:01 +0200 Subject: [PATCH 2/6] dont update editor on changes in disabled filters --- .../kibana/public/visualize/editor/editor.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js index 8432268a4ee94..cc039fc86dc83 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js @@ -117,6 +117,23 @@ uiModules }; }); +function areFilterChangesFetchRelevant(oldFilters, newFilters) { + if (oldFilters.length !== newFilters.length) { + return true; + } + + for (let i = 0; i < oldFilters.length; i++) { + const oldFilter = oldFilters[i]; + const newFilter = newFilters[i]; + + if (oldFilter.meta.disabled !== newFilter.meta.disabled) { + return true; + } + } + + return false; +} + function VisEditor( $scope, $element, @@ -418,8 +435,11 @@ function VisEditor( // update the searchSource when filters update const filterUpdateSubscription = subscribeWithScope($scope, queryFilter.getUpdates$(), { next: () => { + const oldFilters = $scope.filters; $scope.filters = queryFilter.getFilters(); - $scope.fetch(); + if (areFilterChangesFetchRelevant(oldFilters, $scope.filters)) { + $scope.fetch(); + } } }); From 74219df31740fcfdbde97ef0ce8e2c0fd4ef41c0 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 18 Jul 2019 15:20:30 +0200 Subject: [PATCH 3/6] filter out disabled filters in individual embeddables --- .../dashboard/dashboard_app_controller.tsx | 30 ++--------------- .../embeddable/visualize_embeddable.ts | 33 ++++++++++++++++--- .../maps/public/embeddable/map_embeddable.js | 6 ++-- 3 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx index c65735dac529b..ec6755e95c323 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx @@ -82,23 +82,6 @@ import { DashboardAppScope } from './dashboard_app'; import { VISUALIZE_EMBEDDABLE_TYPE } from '../visualize/embeddable'; import { convertSavedDashboardPanelToPanelState } from './lib/embeddable_saved_object_converters'; -function areFilterChangesFetchRelevant(oldFilters: Filter[], newFilters: Filter[]) { - if (oldFilters.length !== newFilters.length) { - return true; - } - - for (let i = 0; i < oldFilters.length; i++) { - const oldFilter = oldFilters[i]; - const newFilter = newFilters[i]; - - if (oldFilter.meta.disabled !== newFilter.meta.disabled) { - return true; - } - } - - return false; -} - export class DashboardAppController { // Part of the exposed plugin API - do not remove without careful consideration. appStatus: { @@ -378,15 +361,7 @@ export class DashboardAppController { const refreshDashboardContainer = () => { const changes = getChangesFromAppStateForContainerState(); - if ( - changes && - dashboardContainer && - !( - changes.filters && - Object.keys(changes).length === 1 && - !areFilterChangesFetchRelevant($scope.model.filters, changes.filters) - ) - ) { + if (changes && dashboardContainer) { dashboardContainer.updateInput(changes); } }; @@ -700,10 +675,9 @@ export class DashboardAppController { // update root source when filters update const updateSubscription = queryFilter.getUpdates$().subscribe({ next: () => { - const oldFilters = $scope.model.filters; $scope.model.filters = queryFilter.getFilters(); dashboardStateManager.applyFilters($scope.model.query, $scope.model.filters); - if (dashboardContainer && areFilterChangesFetchRelevant(oldFilters, $scope.model.filters)) { + if (dashboardContainer) { dashboardContainer.updateInput({ filters: $scope.model.filters }); } }, diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts index a59029fc36ef1..a3a245a2c92eb 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts @@ -67,6 +67,23 @@ export interface VisualizeOutput extends EmbeddableOutput { savedObjectId: string; } +function areFilterChangesFetchRelevant(oldFilters: Filter[], newFilters: Filter[]) { + if (oldFilters.length !== newFilters.length) { + return true; + } + + for (let i = 0; i < oldFilters.length; i++) { + const oldFilter = oldFilters[i]; + const newFilter = newFilters[i]; + + if (oldFilter.meta.disabled !== newFilter.meta.disabled) { + return true; + } + } + + return false; +} + export class VisualizeEmbeddable extends Embeddable { private savedVisualization: VisSavedObject; private loader: VisualizeLoader; @@ -112,7 +129,6 @@ export class VisualizeEmbeddable extends Embeddable { - this.reload(); this.handleChanges(); }); } @@ -157,19 +173,25 @@ export class VisualizeEmbeddable extends Embeddable !filter.meta.disabled), this._prevFilters)) { this._dispatchSetQuery(containerState); } @@ -74,9 +74,9 @@ export class MapEmbeddable extends Embeddable { _dispatchSetQuery({ query, timeRange, filters }) { this._prevTimeRange = timeRange; this._prevQuery = query; - this._prevFilters = filters; + this._prevFilters = filters.filter(filter => !filter.meta.disabled); this._store.dispatch(setQuery({ - filters: filters.filter(filter => !filter.meta.disabled), + filters: this._prevFilters, query, timeFilters: timeRange, })); From 7d1d61ca406ec96d2c8691e5b66ae327d52da4e5 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 18 Jul 2019 15:38:21 +0200 Subject: [PATCH 4/6] simplify code --- .../kibana/public/visualize/editor/editor.js | 23 +++--------- .../embeddable/visualize_embeddable.ts | 36 +++++-------------- 2 files changed, 14 insertions(+), 45 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js index cc039fc86dc83..83e3130e8affd 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js @@ -117,21 +117,8 @@ uiModules }; }); -function areFilterChangesFetchRelevant(oldFilters, newFilters) { - if (oldFilters.length !== newFilters.length) { - return true; - } - - for (let i = 0; i < oldFilters.length; i++) { - const oldFilter = oldFilters[i]; - const newFilter = newFilters[i]; - - if (oldFilter.meta.disabled !== newFilter.meta.disabled) { - return true; - } - } - - return false; +function getEnabledFilters(filters) { + return filters ? filters.filter(filter => !filter.meta.disabled) : undefined; } function VisEditor( @@ -322,7 +309,7 @@ function VisEditor( return appState; }()); - $scope.filters = queryFilter.getFilters(); + $scope.filters = getEnabledFilters(queryFilter.getFilters()); $scope.onFiltersUpdated = filters => { // The filters will automatically be set when the queryFilter emits an update event (see below) @@ -436,8 +423,8 @@ function VisEditor( const filterUpdateSubscription = subscribeWithScope($scope, queryFilter.getUpdates$(), { next: () => { const oldFilters = $scope.filters; - $scope.filters = queryFilter.getFilters(); - if (areFilterChangesFetchRelevant(oldFilters, $scope.filters)) { + $scope.filters = getEnabledFilters(queryFilter.getFilters()); + if (!_.isEqual(oldFilters, $scope.filters)) { $scope.fetch(); } } diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts index a3a245a2c92eb..cf0e710a2afef 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts @@ -67,21 +67,8 @@ export interface VisualizeOutput extends EmbeddableOutput { savedObjectId: string; } -function areFilterChangesFetchRelevant(oldFilters: Filter[], newFilters: Filter[]) { - if (oldFilters.length !== newFilters.length) { - return true; - } - - for (let i = 0; i < oldFilters.length; i++) { - const oldFilter = oldFilters[i]; - const newFilter = newFilters[i]; - - if (oldFilter.meta.disabled !== newFilter.meta.disabled) { - return true; - } - } - - return false; +function getEnabledFilters(filters?: Filter[]) { + return filters ? filters.filter(filter => !filter.meta.disabled) : undefined; } export class VisualizeEmbeddable extends Embeddable { @@ -179,15 +166,10 @@ export class VisualizeEmbeddable extends Embeddable Date: Fri, 19 Jul 2019 11:21:42 +0200 Subject: [PATCH 5/6] check vis customizations for changes and check for changes in filter context for search embeddable --- .../discover/embeddable/search_embeddable.ts | 31 ++++++++++++++++--- .../kibana/public/visualize/editor/editor.js | 13 ++------ .../embeddable/visualize_embeddable.ts | 20 +++++++----- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts b/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts index 8591bb0ed7137..689fea45c6651 100644 --- a/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts @@ -29,6 +29,8 @@ import { getTime } from 'ui/timefilter/get_time'; import { Subscription } from 'rxjs'; import * as Rx from 'rxjs'; import { Filter, FilterStateStore } from '@kbn/es-query'; +import { Query } from 'src/legacy/core_plugins/data/public'; +import { TimeRange } from 'ui/timefilter/time_history'; import { APPLY_FILTER_TRIGGER, Embeddable, @@ -79,6 +81,10 @@ interface SearchEmbeddableConfig { export const SEARCH_EMBEDDABLE_TYPE = 'search'; +function getEnabledFilters(filters?: Filter[]) { + return filters ? filters.filter(filter => !filter.meta.disabled) : undefined; +} + export class SearchEmbeddable extends Embeddable implements ISearchEmbeddable { private readonly savedSearch: SavedSearch; @@ -94,6 +100,10 @@ export class SearchEmbeddable extends Embeddable public readonly type = SEARCH_EMBEDDABLE_TYPE; private filterGen: FilterManager; + private prevTimeRange?: TimeRange; + private prevFilters?: Filter[]; + private prevQuery?: Query; + constructor( { $rootScope, @@ -259,10 +269,21 @@ export class SearchEmbeddable extends Embeddable searchScope.sort = this.input.sort || this.savedSearch.sort; searchScope.sharedItemTitle = this.panelTitle; - this.filtersSearchSource.setField('filter', this.input.filters); - this.filtersSearchSource.setField('query', this.input.query); - - // Sadly this is neccessary to tell the angular component to refetch the data. - this.courier.fetch(); + const enabledFilters = getEnabledFilters(this.input.filters); + if ( + !_.isEqual(this.prevFilters, enabledFilters) || + !_.isEqual(this.prevQuery, this.input.query) || + !_.isEqual(this.prevTimeRange, this.input.timeRange) + ) { + this.filtersSearchSource.setField('filter', enabledFilters); + this.filtersSearchSource.setField('query', this.input.query); + + // Sadly this is neccessary to tell the angular component to refetch the data. + this.courier.fetch(); + + this.prevFilters = enabledFilters; + this.prevQuery = this.input.query; + this.prevTimeRange = this.input.timeRange; + } } } diff --git a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js index 83e3130e8affd..8432268a4ee94 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js @@ -117,10 +117,6 @@ uiModules }; }); -function getEnabledFilters(filters) { - return filters ? filters.filter(filter => !filter.meta.disabled) : undefined; -} - function VisEditor( $scope, $element, @@ -309,7 +305,7 @@ function VisEditor( return appState; }()); - $scope.filters = getEnabledFilters(queryFilter.getFilters()); + $scope.filters = queryFilter.getFilters(); $scope.onFiltersUpdated = filters => { // The filters will automatically be set when the queryFilter emits an update event (see below) @@ -422,11 +418,8 @@ function VisEditor( // update the searchSource when filters update const filterUpdateSubscription = subscribeWithScope($scope, queryFilter.getUpdates$(), { next: () => { - const oldFilters = $scope.filters; - $scope.filters = getEnabledFilters(queryFilter.getFilters()); - if (!_.isEqual(oldFilters, $scope.filters)) { - $scope.fetch(); - } + $scope.filters = queryFilter.getFilters(); + $scope.fetch(); } }); diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts index cf0e710a2afef..c52af63c2fdcf 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts @@ -80,6 +80,7 @@ export class VisualizeEmbeddable extends Embeddable { - this.uiState.set(key, visCustomizations[key]); - }); - this.uiState.on('change', this.uiStateChangeHandler); + if (!_.isEqual(visCustomizations, this.visCustomizations)) { + this.visCustomizations = visCustomizations; + // Turn this off or the uiStateChangeHandler will fire for every modification. + this.uiState.off('change', this.uiStateChangeHandler); + this.uiState.clearAllKeys(); + this.uiState.set('vis', visCustomizations); + getKeys(visCustomizations).forEach(key => { + this.uiState.set(key, visCustomizations[key]); + }); + this.uiState.on('change', this.uiStateChangeHandler); + } } else { this.uiState.clearAllKeys(); } From 8bf309408f92bfaccd7659eee1a72d84476ac78e Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 29 Jul 2019 10:52:52 +0200 Subject: [PATCH 6/6] use onlyDisabledFiltersChanged to avoid redundant code --- .../filter_manager/lib/only_disabled.test.ts | 10 ++++++++++ .../filter/filter_manager/lib/only_disabled.ts | 6 +++--- .../discover/embeddable/search_embeddable.ts | 13 ++++--------- .../visualize/embeddable/visualize_embeddable.ts | 15 +++++---------- .../maps/public/embeddable/map_embeddable.js | 7 ++++--- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/legacy/core_plugins/data/public/filter/filter_manager/lib/only_disabled.test.ts b/src/legacy/core_plugins/data/public/filter/filter_manager/lib/only_disabled.test.ts index 52dd27e9fc7ad..7a3b767b97b1b 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_manager/lib/only_disabled.test.ts +++ b/src/legacy/core_plugins/data/public/filter/filter_manager/lib/only_disabled.test.ts @@ -34,6 +34,16 @@ describe('Filter Bar Directive', function() { expect(onlyDisabledFiltersChanged(newFilters, filters)).to.be(true); }); + it('should return false if there are no old filters', function() { + const newFilters = [{ meta: { disabled: false } }] as Filter[]; + expect(onlyDisabledFiltersChanged(newFilters, undefined)).to.be(false); + }); + + it('should return false if there are no new filters', function() { + const filters = [{ meta: { disabled: false } }] as Filter[]; + expect(onlyDisabledFiltersChanged(undefined, filters)).to.be(false); + }); + it('should return false if all filters are not disabled', function() { const filters = [ { meta: { disabled: false } }, diff --git a/src/legacy/core_plugins/data/public/filter/filter_manager/lib/only_disabled.ts b/src/legacy/core_plugins/data/public/filter/filter_manager/lib/only_disabled.ts index 6df761c3db09f..24f6b6db5352b 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_manager/lib/only_disabled.ts +++ b/src/legacy/core_plugins/data/public/filter/filter_manager/lib/only_disabled.ts @@ -27,10 +27,10 @@ const isEnabled = function(filter: Filter) { * Checks to see if only disabled filters have been changed * @returns {bool} Only disabled filters */ -export function onlyDisabledFiltersChanged(newFilters: Filter[], oldFilters: Filter[]) { +export function onlyDisabledFiltersChanged(newFilters?: Filter[], oldFilters?: Filter[]) { // If it's the same - compare only enabled filters - const newEnabledFilters = _.filter(newFilters, isEnabled); - const oldEnabledFilters = _.filter(oldFilters, isEnabled); + const newEnabledFilters = _.filter(newFilters || [], isEnabled); + const oldEnabledFilters = _.filter(oldFilters || [], isEnabled); return _.isEqual(oldEnabledFilters, newEnabledFilters); } diff --git a/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts b/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts index 689fea45c6651..7dec893f68025 100644 --- a/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts @@ -29,8 +29,8 @@ import { getTime } from 'ui/timefilter/get_time'; import { Subscription } from 'rxjs'; import * as Rx from 'rxjs'; import { Filter, FilterStateStore } from '@kbn/es-query'; -import { Query } from 'src/legacy/core_plugins/data/public'; import { TimeRange } from 'ui/timefilter/time_history'; +import { Query, onlyDisabledFiltersChanged } from '../../../../data/public'; import { APPLY_FILTER_TRIGGER, Embeddable, @@ -81,10 +81,6 @@ interface SearchEmbeddableConfig { export const SEARCH_EMBEDDABLE_TYPE = 'search'; -function getEnabledFilters(filters?: Filter[]) { - return filters ? filters.filter(filter => !filter.meta.disabled) : undefined; -} - export class SearchEmbeddable extends Embeddable implements ISearchEmbeddable { private readonly savedSearch: SavedSearch; @@ -269,19 +265,18 @@ export class SearchEmbeddable extends Embeddable searchScope.sort = this.input.sort || this.savedSearch.sort; searchScope.sharedItemTitle = this.panelTitle; - const enabledFilters = getEnabledFilters(this.input.filters); if ( - !_.isEqual(this.prevFilters, enabledFilters) || + !onlyDisabledFiltersChanged(this.input.filters, this.prevFilters) || !_.isEqual(this.prevQuery, this.input.query) || !_.isEqual(this.prevTimeRange, this.input.timeRange) ) { - this.filtersSearchSource.setField('filter', enabledFilters); + this.filtersSearchSource.setField('filter', this.input.filters); this.filtersSearchSource.setField('query', this.input.query); // Sadly this is neccessary to tell the angular component to refetch the data. this.courier.fetch(); - this.prevFilters = enabledFilters; + this.prevFilters = this.input.filters; this.prevQuery = this.input.query; this.prevTimeRange = this.input.timeRange; } diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts index c52af63c2fdcf..c1b9bfd42cc43 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable.ts @@ -38,8 +38,8 @@ import { import { Subscription } from 'rxjs'; import * as Rx from 'rxjs'; import { TimeRange } from 'ui/timefilter/time_history'; -import { Query } from 'src/legacy/core_plugins/data/public'; import { Filter } from '@kbn/es-query'; +import { Query, onlyDisabledFiltersChanged } from '../../../../data/public'; import { VISUALIZE_EMBEDDABLE_TYPE } from './constants'; const getKeys = (o: T): Array => Object.keys(o) as Array; @@ -67,10 +67,6 @@ export interface VisualizeOutput extends EmbeddableOutput { savedObjectId: string; } -function getEnabledFilters(filters?: Filter[]) { - return filters ? filters.filter(filter => !filter.meta.disabled) : undefined; -} - export class VisualizeEmbeddable extends Embeddable { private savedVisualization: VisSavedObject; private loader: VisualizeLoader; @@ -170,10 +166,9 @@ export class VisualizeEmbeddable extends Embeddable !filter.meta.disabled), this._prevFilters)) { + !onlyDisabledFiltersChanged(containerState.filters, this._prevFilters)) { this._dispatchSetQuery(containerState); } @@ -77,9 +78,9 @@ export class MapEmbeddable extends Embeddable { _dispatchSetQuery({ query, timeRange, filters }) { this._prevTimeRange = timeRange; this._prevQuery = query; - this._prevFilters = filters.filter(filter => !filter.meta.disabled); + this._prevFilters = filters; this._store.dispatch(setQuery({ - filters: this._prevFilters, + filters: filters.filter(filter => !filter.meta.disabled), query, timeFilters: timeRange, }));