From d5eb45f8d2b1217c18f2a015de295ce39a3895e8 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 6 Nov 2019 18:57:22 +0200 Subject: [PATCH] closes #44349, as well as SDH issue #64 --- .../public/query/filter_manager/filter_manager.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/data/public/query/filter_manager/filter_manager.ts b/src/plugins/data/public/query/filter_manager/filter_manager.ts index 66b65a40926cb..2f34759090869 100644 --- a/src/plugins/data/public/query/filter_manager/filter_manager.ts +++ b/src/plugins/data/public/query/filter_manager/filter_manager.ts @@ -76,10 +76,14 @@ export class FilterManager { private handleStateUpdate(newFilters: Filter[]) { // global filters should always be first newFilters.sort(({ $state: a }: Filter, { $state: b }: Filter): number => { - return a!.store === FilterStateStore.GLOBAL_STATE && - b!.store !== FilterStateStore.GLOBAL_STATE - ? -1 - : 1; + if (a!.store === b!.store) { + return 0; + } else { + return a!.store === FilterStateStore.GLOBAL_STATE && + b!.store !== FilterStateStore.GLOBAL_STATE + ? -1 + : 1; + } }); const filtersUpdated = !_.isEqual(this.filters, newFilters);