mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Fix intermitting series state (#115747)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
9714aac93c
commit
d4d470d938
2 changed files with 8 additions and 6 deletions
|
@ -91,12 +91,12 @@ export const useLensAttributes = (): TypedLensByValueInput['attributes'] | null
|
|||
const theme = useTheme();
|
||||
|
||||
return useMemo(() => {
|
||||
if (isEmpty(indexPatterns) || isEmpty(allSeries) || !reportType) {
|
||||
return null;
|
||||
}
|
||||
// we only use the data from url to apply, since that get's updated to apply changes
|
||||
// we only use the data from url to apply, since that gets updated to apply changes
|
||||
const allSeriesT: AllSeries = convertAllShortSeries(storage.get(allSeriesKey) ?? []);
|
||||
|
||||
if (isEmpty(indexPatterns) || isEmpty(allSeriesT) || !reportType) {
|
||||
return null;
|
||||
}
|
||||
const layerConfigs = getLayerConfigs(allSeriesT, reportType, theme, indexPatterns);
|
||||
|
||||
if (layerConfigs.length < 1) {
|
||||
|
@ -106,5 +106,7 @@ export const useLensAttributes = (): TypedLensByValueInput['attributes'] | null
|
|||
const lensAttributes = new LensAttributes(layerConfigs);
|
||||
|
||||
return lensAttributes.getJSON(lastRefresh);
|
||||
}, [indexPatterns, allSeries, reportType, storage, theme, lastRefresh]);
|
||||
// we also want to check the state on allSeries changes
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [indexPatterns, reportType, storage, theme, lastRefresh, allSeries]);
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ export function LensEmbeddable(props: Props) {
|
|||
[reportType, setSeries, firstSeries, notifications?.toasts]
|
||||
);
|
||||
|
||||
if (!timeRange || !firstSeries) {
|
||||
if (!timeRange || !lensAttributes) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue