mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[ML] Transforms: Reduce rerenders and multiple fetches of source index on transform wizard load. (#160979)
Adds checks to avoid unnecessary initial rerenders and refetches of data when loading the transform wizard. This reduces rerenders from 14 to 11 and more importantly the request to fetch index data is triggered only once instead of three times. One of the requests even triggered an error which could briefly trigger a callout on slower connections.
This commit is contained in:
parent
ea53763028
commit
fc4edd68a5
1 changed files with 6 additions and 0 deletions
|
@ -86,6 +86,9 @@ export const useIndexData = (
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (dataView.timeFieldName !== undefined && timeRangeMs === undefined) {
|
||||
return;
|
||||
}
|
||||
const abortController = new AbortController();
|
||||
|
||||
// Fetch 500 random documents to determine populated fields.
|
||||
|
@ -197,6 +200,9 @@ export const useIndexData = (
|
|||
}, [JSON.stringify([query, timeRangeMs])]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof dataViewFields === 'undefined') {
|
||||
return;
|
||||
}
|
||||
const abortController = new AbortController();
|
||||
|
||||
const fetchDataGridData = async function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue