[8.13] [Security Solution] [Analyzer] Do not clear analyzer state when mounting/unmounting (#178770) (#178775)

# Backport

This will backport the following commits from `main` to `8.13`:
- [[Security Solution] [Analyzer] Do not clear analyzer state when
mounting/unmounting
(#178770)](https://github.com/elastic/kibana/pull/178770)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Kevin
Qualters","email":"56408403+kqualters-elastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-03-14T21:09:54Z","message":"[Security
Solution] [Analyzer] Do not clear analyzer state when
mounting/unmounting (#178770)\n\n## Summary\r\n\r\nRelated issue:
https://github.com/elastic/kibana/issues/178697\r\n\r\nClearing the
state of analyzer completely when this hook dismounts is\r\nnot actually
needed, as analyzer will refetch data with any new\r\nparameters are
passed from the security solution code, and doing so also\r\ncaused the
related bug. Removing this line fixes the
problem.\r\n\r\n\r\n![fullscreen_back](e1e53e02-c402-4560-b4bc-a021c21093bb)\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"f1d0cd145e083397b531ac5ae96d6e76da9b4c50","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","v8.13.0","v8.14.0"],"title":"[Security
Solution] [Analyzer] Do not clear analyzer state when
mounting/unmounting","number":178770,"url":"https://github.com/elastic/kibana/pull/178770","mergeCommit":{"message":"[Security
Solution] [Analyzer] Do not clear analyzer state when
mounting/unmounting (#178770)\n\n## Summary\r\n\r\nRelated issue:
https://github.com/elastic/kibana/issues/178697\r\n\r\nClearing the
state of analyzer completely when this hook dismounts is\r\nnot actually
needed, as analyzer will refetch data with any new\r\nparameters are
passed from the security solution code, and doing so also\r\ncaused the
related bug. Removing this line fixes the
problem.\r\n\r\n\r\n![fullscreen_back](e1e53e02-c402-4560-b4bc-a021c21093bb)\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"f1d0cd145e083397b531ac5ae96d6e76da9b4c50"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/178770","number":178770,"mergeCommit":{"message":"[Security
Solution] [Analyzer] Do not clear analyzer state when
mounting/unmounting (#178770)\n\n## Summary\r\n\r\nRelated issue:
https://github.com/elastic/kibana/issues/178697\r\n\r\nClearing the
state of analyzer completely when this hook dismounts is\r\nnot actually
needed, as analyzer will refetch data with any new\r\nparameters are
passed from the security solution code, and doing so also\r\ncaused the
related bug. Removing this line fixes the
problem.\r\n\r\n\r\n![fullscreen_back](e1e53e02-c402-4560-b4bc-a021c21093bb)\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"f1d0cd145e083397b531ac5ae96d6e76da9b4c50"}}]}]
BACKPORT-->

Co-authored-by: Kevin Qualters <56408403+kqualters-elastic@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-03-14 18:28:22 -04:00 committed by GitHub
parent c7ba73a309
commit 24b56c2013
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,6 @@
import { useRef, useEffect } from 'react';
import { useLocation, useHistory } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { clearResolver } from '../store/actions';
import { parameterName } from '../store/parameter_name';
/**
* Cleanup any query string keys that were added by this Resolver instance.
@ -49,7 +48,6 @@ export function useResolverQueryParamCleaner(id: string) {
urlSearchParams.delete(oldResolverKey);
const relativeURL = { search: urlSearchParams.toString() };
history.replace(relativeURL);
dispatch(clearResolver({ id }));
};
}, [resolverKey, history, dispatch, id]);
}