mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Cloud Security] Fix for console error message in rules benchmark page (#177887)
## Summary Currently in Rules benchmark page, users seems to be getting error message in their console (not affecting the UI). This error is caused by malformed request to detection rule API and this is due to us sending an empty Array. This is not a problem on other component as in other component the API is called after users clicks to open the component which will in turn fill in the array which means the array is never empty. This is not the issue with this case as the API is called even in the beginning The solution in this PR is basically just giving default return value if its ever empty
This commit is contained in:
parent
0bd29c9ef4
commit
c1ccb1d3d3
1 changed files with 6 additions and 3 deletions
|
@ -39,9 +39,12 @@ export const useFetchDetectionRulesByTags = (
|
|||
option: { match: 'all' | 'any' } = { match: 'all' }
|
||||
) => {
|
||||
const { http } = useKibana<CoreStart>().services;
|
||||
return useQuery([DETECTION_ENGINE_RULES_KEY, tags, option], () =>
|
||||
fetchDetectionRulesByTags(tags, option, http)
|
||||
);
|
||||
|
||||
return useQuery({
|
||||
queryKey: [DETECTION_ENGINE_RULES_KEY, tags, option],
|
||||
queryFn: () => fetchDetectionRulesByTags(tags, option, http),
|
||||
enabled: tags.length > 0,
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchDetectionRulesByTags = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue