diff --git a/src/plugins/discover/public/application/main/components/field_stats_table/field_stats_table.tsx b/src/plugins/discover/public/application/main/components/field_stats_table/field_stats_table.tsx index 29c5c622d8a83..efc7afafd292b 100644 --- a/src/plugins/discover/public/application/main/components/field_stats_table/field_stats_table.tsx +++ b/src/plugins/discover/public/application/main/components/field_stats_table/field_stats_table.tsx @@ -74,7 +74,7 @@ export const FieldStatisticsTable = React.memo((props: FieldStatisticsTableProps const lastReloadRequestTime$ = useMemo(() => { return stateContainer?.dataState?.refetch$ ? stateContainer?.dataState?.refetch$.pipe( - map((d) => { + map(() => { return Date.now(); }) ) diff --git a/src/plugins/discover/public/application/main/components/layout/discover_main_content.tsx b/src/plugins/discover/public/application/main/components/layout/discover_main_content.tsx index f98dba03688af..735eae1fa9039 100644 --- a/src/plugins/discover/public/application/main/components/layout/discover_main_content.tsx +++ b/src/plugins/discover/public/application/main/components/layout/discover_main_content.tsx @@ -67,12 +67,7 @@ export const DiscoverMainContent = ({ const setDiscoverViewMode = useCallback( (mode: VIEW_MODE) => { - stateContainer.appState.update( - // Resetting to default viewMode: undefined if document level - // else change for viewMode from undefined to DOCUMENT_LEVEL will triger unsaved changes badge - { viewMode: mode }, - true - ); + stateContainer.appState.update({ viewMode: mode }, true); if (trackUiMetric) { if (mode === VIEW_MODE.AGGREGATED_LEVEL) { diff --git a/src/plugins/discover/public/application/main/hooks/use_esql_mode.test.tsx b/src/plugins/discover/public/application/main/hooks/use_esql_mode.test.tsx index 11592d717d015..12109ea01a422 100644 --- a/src/plugins/discover/public/application/main/hooks/use_esql_mode.test.tsx +++ b/src/plugins/discover/public/application/main/hooks/use_esql_mode.test.tsx @@ -104,7 +104,7 @@ describe('useEsqlMode', () => { stateContainer.dataState.data$.documents$.next(msgComplete); expect(replaceUrlState).toHaveBeenCalledTimes(0); }); - test('should change viewMode to undefined (default) if it was AGGREGATED_LEVEL', async () => { + test('should not change viewMode to undefined (default) if it was AGGREGATED_LEVEL', async () => { const { replaceUrlState } = renderHookWithContext(false, { viewMode: VIEW_MODE.AGGREGATED_LEVEL, }); diff --git a/src/plugins/discover/public/application/main/utils/get_valid_view_mode.ts b/src/plugins/discover/public/application/main/utils/get_valid_view_mode.ts index 4709d9d230c10..96defe6711d95 100644 --- a/src/plugins/discover/public/application/main/utils/get_valid_view_mode.ts +++ b/src/plugins/discover/public/application/main/utils/get_valid_view_mode.ts @@ -21,7 +21,7 @@ export const getValidViewMode = ({ isEsqlMode: boolean; }): VIEW_MODE | undefined => { if (viewMode === VIEW_MODE.PATTERN_LEVEL && isEsqlMode) { - // only this mode is supported for text-based languages + // only this mode is supported for ES|QL languages return VIEW_MODE.DOCUMENT_LEVEL; } diff --git a/test/functional/apps/discover/group6/_view_mode_toggle.ts b/test/functional/apps/discover/group6/_view_mode_toggle.ts index c915691f2d3e2..415cb9f1fb85e 100644 --- a/test/functional/apps/discover/group6/_view_mode_toggle.ts +++ b/test/functional/apps/discover/group6/_view_mode_toggle.ts @@ -107,7 +107,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.existOrFail('dscViewModeToggle'); }); - it('should still show view mode toggle for text-based searches', async () => { + it('should still show view mode toggle for ES|QL searches', async () => { await testSubjects.click('dscViewModeDocumentButton'); await retry.try(async () => {