[Lens][ES|QL] Do not rerun the hook in case of an error in the query#225067
[Lens][ES|QL] Do not rerun the hook in case of an error in the query#225067stratoula merged 8 commits intoelastic:mainfrom
Conversation
| }); | ||
|
|
||
| initializeChartFunc(abortController); | ||
| }, [args]); |
There was a problem hiding this comment.
A new object is passed every time, triggering this useEffect all the times.
Also the object is shallow copied at every execution.
I think we should do something better here and avoid useless executions.
There was a problem hiding this comment.
the check is not allowing to set the states or execute the query , what do you have in mind?
dej611
left a comment
There was a problem hiding this comment.
Tested locally and it fixes the issue ���
Left a minor code comment, but will approve to unblock it.
| ] | ||
| ); | ||
| useEffect(() => { | ||
| const abortController = new AbortController(); |
There was a problem hiding this comment.
nit: this can be moved inside the initializeChartFunc content? I do not see any other context where it will be passed elsewhere.
|
Starting backport for target branches: 8.19 |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
History
|
…lastic#225067) ## Summary While testing the ES|QL charts I realized that in case of an error in the query, the hook goes into a loop and causes performance issues. As the error is being reported we do not need to re-run the query to get the results For example if you create a control wrongly. e.g. 1. Create a chart and add a control which will create an error: <img width="508" alt="image" src="https://github.com/user-attachments/assets/f2013d2c-e161-47bf-a3cb-d5033be9de59" /> 2. Add to the control no-date fields. e.g. clientip 3. Check the editor is not going into a rendering loop <img width="482" alt="image" src="https://github.com/user-attachments/assets/cc541b68-b317-41ae-b4a6-87569466edd6" /> ### Release notes Fixes a performance issue in the Lens ES|QL charts in case of errors in the query. ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit 731ab84)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
… query (#225067) (#225480) # Backport This will backport the following commits from `main` to `8.19`: - [[Lens][ES|QL] Do not rerun the hook in case of an error in the query (#225067)](#225067) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Stratoula Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2025-06-26T14:56:50Z","message":"[Lens][ES|QL] Do not rerun the hook in case of an error in the query (#225067)\n\n## Summary\n\nWhile testing the ES|QL charts I realized that in case of an error in\nthe query, the hook goes into a loop and causes performance issues.\n\nAs the error is being reported we do not need to re-run the query to get\nthe results\n\nFor example if you create a control wrongly.\n\ne.g.\n\n1. Create a chart and add a control which will create an error:\n\n<img width=\"508\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/f2013d2c-e161-47bf-a3cb-d5033be9de59\"\n/>\n\n2. Add to the control no-date fields. e.g. clientip\n3. Check the editor is not going into a rendering loop\n\n<img width=\"482\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cc541b68-b317-41ae-b4a6-87569466edd6\"\n/>\n\n\n### Release notes\nFixes a performance issue in the Lens ES|QL charts in case of errors in\nthe query.\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"731ab844879e068da6c9d60e206ddc501c49f415","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Lens","Feature:ES|QL","backport:version","v9.1.0","v8.19.0"],"title":"[Lens][ES|QL] Do not rerun the hook in case of an error in the query","number":225067,"url":"https://github.com/elastic/kibana/pull/225067","mergeCommit":{"message":"[Lens][ES|QL] Do not rerun the hook in case of an error in the query (#225067)\n\n## Summary\n\nWhile testing the ES|QL charts I realized that in case of an error in\nthe query, the hook goes into a loop and causes performance issues.\n\nAs the error is being reported we do not need to re-run the query to get\nthe results\n\nFor example if you create a control wrongly.\n\ne.g.\n\n1. Create a chart and add a control which will create an error:\n\n<img width=\"508\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/f2013d2c-e161-47bf-a3cb-d5033be9de59\"\n/>\n\n2. Add to the control no-date fields. e.g. clientip\n3. Check the editor is not going into a rendering loop\n\n<img width=\"482\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cc541b68-b317-41ae-b4a6-87569466edd6\"\n/>\n\n\n### Release notes\nFixes a performance issue in the Lens ES|QL charts in case of errors in\nthe query.\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"731ab844879e068da6c9d60e206ddc501c49f415"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225067","number":225067,"mergeCommit":{"message":"[Lens][ES|QL] Do not rerun the hook in case of an error in the query (#225067)\n\n## Summary\n\nWhile testing the ES|QL charts I realized that in case of an error in\nthe query, the hook goes into a loop and causes performance issues.\n\nAs the error is being reported we do not need to re-run the query to get\nthe results\n\nFor example if you create a control wrongly.\n\ne.g.\n\n1. Create a chart and add a control which will create an error:\n\n<img width=\"508\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/f2013d2c-e161-47bf-a3cb-d5033be9de59\"\n/>\n\n2. Add to the control no-date fields. e.g. clientip\n3. Check the editor is not going into a rendering loop\n\n<img width=\"482\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cc541b68-b317-41ae-b4a6-87569466edd6\"\n/>\n\n\n### Release notes\nFixes a performance issue in the Lens ES|QL charts in case of errors in\nthe query.\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"731ab844879e068da6c9d60e206ddc501c49f415"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Summary
While testing the ES|QL charts I realized that in case of an error in the query, the hook goes into a loop and causes performance issues.
As the error is being reported we do not need to re-run the query to get the results
For example if you create a control wrongly.
e.g.
Release notes
Fixes a performance issue in the Lens ES|QL charts in case of errors in the query.
Checklist