mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Infra] Fix control filters loading (#189050)
fixes [189049](https://github.com/elastic/kibana/issues/189049) ## Summary Fix a problem when loading the control filters when data view is still loading https://github.com/user-attachments/assets/f98dd4ae-72c6-4e19-9f25-99ff6a1e752c ### How to test - Start a local Kibana instance - Navigate to Infrastructure > Host - Performa a full page refresh Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
9e71c7e830
commit
b99c392b5c
1 changed files with 22 additions and 15 deletions
|
@ -40,21 +40,24 @@ export const ControlsContent: React.FC<Props> = ({
|
|||
const [controlPanels, setControlPanels] = useControlPanels(dataView);
|
||||
const subscriptions = useRef<Subscription>(new Subscription());
|
||||
|
||||
const getInitialInput = useCallback(async () => {
|
||||
const initialInput: Partial<ControlGroupInput> = {
|
||||
id: dataView?.id ?? '',
|
||||
viewMode: ViewMode.VIEW,
|
||||
chainingSystem: 'HIERARCHICAL',
|
||||
controlStyle: 'oneLine',
|
||||
defaultControlWidth: 'small',
|
||||
panels: controlPanels,
|
||||
filters,
|
||||
query,
|
||||
timeRange,
|
||||
};
|
||||
const getInitialInput = useCallback(
|
||||
(loadedDataView: DataView) => async () => {
|
||||
const initialInput: Partial<ControlGroupInput> = {
|
||||
id: loadedDataView.id,
|
||||
viewMode: ViewMode.VIEW,
|
||||
chainingSystem: 'HIERARCHICAL',
|
||||
controlStyle: 'oneLine',
|
||||
defaultControlWidth: 'small',
|
||||
panels: controlPanels,
|
||||
filters,
|
||||
query,
|
||||
timeRange,
|
||||
};
|
||||
|
||||
return { initialInput };
|
||||
}, [controlPanels, dataView?.id, filters, query, timeRange]);
|
||||
return { initialInput };
|
||||
},
|
||||
[controlPanels, filters, query, timeRange]
|
||||
);
|
||||
|
||||
const loadCompleteHandler = useCallback(
|
||||
(controlGroup: ControlGroupAPI) => {
|
||||
|
@ -90,10 +93,14 @@ export const ControlsContent: React.FC<Props> = ({
|
|||
};
|
||||
}, []);
|
||||
|
||||
if (!dataView) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ControlGroupContainer>
|
||||
<ControlGroupRenderer
|
||||
getCreationOptions={getInitialInput}
|
||||
getCreationOptions={getInitialInput(dataView)}
|
||||
ref={loadCompleteHandler}
|
||||
timeRange={timeRange}
|
||||
query={query}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue