diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_functions.ts b/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_functions.ts index 375b03b73b3f4..c4886c55d976c 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_functions.ts +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_functions.ts @@ -125,6 +125,6 @@ const shouldRefreshFilterCompareOptions = { export const shouldRefreshDiffingFunctions: DashboardDiffFunctions = { ...unsavedChangesDiffingFunctions, - filters: ({ currentValue, lastValue }) => + filters: ({ currentValue, lastValue }) => onlyDisabledFiltersChanged(lastValue, currentValue, shouldRefreshFilterCompareOptions), }; diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_integration.test.ts b/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_integration.test.ts index ca17780f3e803..6c4e9c3989cd7 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_integration.test.ts +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_integration.test.ts @@ -7,8 +7,10 @@ */ import { buildExistsFilter, disableFilter, pinFilter, toggleFilterNegated } from '@kbn/es-query'; +import type { DataViewFieldBase, DataViewBase } from '@kbn/es-query'; import { getShouldRefresh } from './dashboard_diffing_integration'; import { DashboardContainer } from '../../dashboard_container'; +import { DashboardContainerByValueInput } from '../../../../../common'; describe('getShouldRefresh', () => { const dashboardContainerMock = { @@ -28,10 +30,10 @@ describe('getShouldRefresh', () => { const pinnedFilter = pinFilter(existsFilter); const lastInput = { filters: [pinnedFilter], - }; + } as unknown as DashboardContainerByValueInput; const input = { filters: [toggleFilterNegated(pinnedFilter)], - }; + } as unknown as DashboardContainerByValueInput; expect(await getShouldRefresh.bind(dashboardContainerMock)(lastInput, { ...lastInput })).toBe( false ); @@ -42,20 +44,20 @@ describe('getShouldRefresh', () => { const disabledFilter = disableFilter(existsFilter); const lastInput = { filters: [disabledFilter], - }; + } as unknown as DashboardContainerByValueInput; const input = { filters: [toggleFilterNegated(disabledFilter)], - }; + } as unknown as DashboardContainerByValueInput; expect(await getShouldRefresh.bind(dashboardContainerMock)(lastInput, input)).toBe(false); }); test('should return false when pinned filter changes to unpinned', async () => { const lastInput = { filters: [existsFilter], - }; + } as unknown as DashboardContainerByValueInput; const input = { filters: [pinFilter(existsFilter)], - }; + } as unknown as DashboardContainerByValueInput; expect(await getShouldRefresh.bind(dashboardContainerMock)(lastInput, input)).toBe(false); }); }); diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_integration.ts b/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_integration.ts index 73a28609408bc..2062ac3a4b620 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_integration.ts +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/integrations/diff_state/dashboard_diffing_integration.ts @@ -13,6 +13,7 @@ import { DashboardContainer } from '../../dashboard_container'; import { pluginServices } from '../../../../services/plugin_services'; import { DashboardContainerByValueInput } from '../../../../../common'; import { CHANGE_CHECK_DEBOUNCE } from '../../../../dashboard_constants'; +import type { DashboardDiffFunctions } from './dashboard_diffing_functions'; import { isKeyEqual, shouldRefreshDiffingFunctions, @@ -178,7 +179,7 @@ export async function getShouldRefresh( this: DashboardContainer, lastInput: DashboardContainerByValueInput, input: DashboardContainerByValueInput -): Promise> { +): Promise { const inputChanges = await getInputChanges( this, lastInput,