Skip to content

Commit

Permalink
[8.11] [Security Solution] Fixes ES|QL Tab resetting to KQL Bar (#168716
Browse files Browse the repository at this point in the history
) (#168784)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Security Solution] Fixes ES|QL Tab resetting to KQL Bar
(#168716)](#168716)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jatin
Kathuria","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-13T06:22:06Z","message":"[Security
Solution] Fixes ES|QL Tab resetting to KQL Bar (#168716)\n\n##
Summary\r\n\r\nHandles #168431\r\n\r\nThis PR fixes a race condition
which was causing Discover ES|QL tab to\r\nrevert to it KQL query bar.
See demo below:\r\n\r\n| Before | After |\r\n|---|---|\r\n|
<video\r\nsrc=\"https://github.com/elastic/kibana/assets/7485038/24ff8ca9-30ce-4581-94d7-52908a2c81fd\"\r\n/>|<video\r\nsrc=\"https://github.com/elastic/kibana/assets/7485038/746946ad-bd69-412f-bd38-d3d79b570c68\"\r\n/>|","sha":"6fd6966ed8225935feee247b04b4988424b47c88","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","v8.11.0","v8.12.0"],"number":168716,"url":"https://github.com/elastic/kibana/pull/168716","mergeCommit":{"message":"[Security
Solution] Fixes ES|QL Tab resetting to KQL Bar (#168716)\n\n##
Summary\r\n\r\nHandles #168431\r\n\r\nThis PR fixes a race condition
which was causing Discover ES|QL tab to\r\nrevert to it KQL query bar.
See demo below:\r\n\r\n| Before | After |\r\n|---|---|\r\n|
<video\r\nsrc=\"https://github.com/elastic/kibana/assets/7485038/24ff8ca9-30ce-4581-94d7-52908a2c81fd\"\r\n/>|<video\r\nsrc=\"https://github.com/elastic/kibana/assets/7485038/746946ad-bd69-412f-bd38-d3d79b570c68\"\r\n/>|","sha":"6fd6966ed8225935feee247b04b4988424b47c88"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168716","number":168716,"mergeCommit":{"message":"[Security
Solution] Fixes ES|QL Tab resetting to KQL Bar (#168716)\n\n##
Summary\r\n\r\nHandles #168431\r\n\r\nThis PR fixes a race condition
which was causing Discover ES|QL tab to\r\nrevert to it KQL query bar.
See demo below:\r\n\r\n| Before | After |\r\n|---|---|\r\n|
<video\r\nsrc=\"https://github.com/elastic/kibana/assets/7485038/24ff8ca9-30ce-4581-94d7-52908a2c81fd\"\r\n/>|<video\r\nsrc=\"https://github.com/elastic/kibana/assets/7485038/746946ad-bd69-412f-bd38-d3d79b570c68\"\r\n/>|","sha":"6fd6966ed8225935feee247b04b4988424b47c88"}}]}]
BACKPORT-->

Co-authored-by: Jatin Kathuria <[email protected]>
  • Loading branch information
kibanamachine and logeekal authored Oct 13, 2023
1 parent 5dc69b4 commit 12a59a2
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ export const DiscoverTabContent: FC<DiscoverTabContentProps> = ({ timelineId })
if (!savedObjectId) return;
if (!status || status === 'draft') return;
const latestState = getCombinedDiscoverSavedSearchState();
const index = latestState?.searchSource.getField('index');
/* when a new timeline is loaded, a new discover instance is loaded which first emits
* discover's initial state which is then updated in the saved search. We want to avoid that.*/
if (!index) return;
if (!latestState || combinedDiscoverSavedSearchStateRef.current === latestState) return;
if (isEqualWith(latestState, savedSearchById, savedSearchComparator)) return;
debouncedUpdateSavedSearch(latestState, timelineId);
Expand Down

0 comments on commit 12a59a2

Please sign in to comment.