[8.x] [React@18] fix incorrect `useEffect` return value (#195421) (#195468)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[React@18] fix incorrect `useEffect` return value
(#195421)](https://github.com/elastic/kibana/pull/195421)

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

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

<!--BACKPORT [{"author":{"name":"Anton
Dosov","email":"anton.dosov@elastic.co"},"sourceCommit":{"committedDate":"2024-10-08T16:17:17Z","message":"[React@18]
fix incorrect `useEffect` return value
(#195421)","sha":"d03537f21764fda1fbafcfec03391b3e03b64e82","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:SharedUX","backport:prev-minor"],"title":"[React@18]
fix incorrect `useEffect` return
value","number":195421,"url":"https://github.com/elastic/kibana/pull/195421","mergeCommit":{"message":"[React@18]
fix incorrect `useEffect` return value
(#195421)","sha":"d03537f21764fda1fbafcfec03391b3e03b64e82"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195421","number":195421,"mergeCommit":{"message":"[React@18]
fix incorrect `useEffect` return value
(#195421)","sha":"d03537f21764fda1fbafcfec03391b3e03b64e82"}}]}]
BACKPORT-->

Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-09 05:13:37 +11:00 committed by GitHub
parent db6cd8fd1d
commit 21f9d06890
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -35,7 +35,9 @@ export const ElasticsearchGuide = () => {
const { data } = useValues(FetchApiKeysAPILogic);
const apiKeys = data?.api_keys || [];
useEffect(() => makeRequest({}), []);
useEffect(() => {
makeRequest({});
}, []);
return (
<EnterpriseSearchElasticsearchPageTemplate>

View file

@ -42,7 +42,9 @@ export const ApiKeyPanel: React.FC = () => {
const [isFlyoutOpen, setIsFlyoutOpen] = useState(false);
const elasticsearchEndpoint = esConfig.elasticsearch_host;
useEffect(() => makeRequest({}), []);
useEffect(() => {
makeRequest({});
}, []);
const apiKeys = data?.api_keys || [];
const cloudId = cloud?.cloudId;