mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
(cherry picked from commit b1a88f5c61
)
Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
This commit is contained in:
parent
600d24903b
commit
73c6353817
4 changed files with 6 additions and 6 deletions
|
@ -8,9 +8,9 @@
|
|||
import { useLayoutEffect, ReactNode } from 'react';
|
||||
|
||||
interface RenderCounterProps {
|
||||
initialRender: Function;
|
||||
postponeExecution?: boolean;
|
||||
children?: ReactNode;
|
||||
initialRender: Function | undefined;
|
||||
}
|
||||
|
||||
/** HOC component to call "initialRender" method after finishing all DOM mutations. **/
|
||||
|
@ -21,7 +21,7 @@ export const RenderCounter = ({
|
|||
}: RenderCounterProps) => {
|
||||
useLayoutEffect(() => {
|
||||
if (!postponeExecution) {
|
||||
initialRender();
|
||||
initialRender?.();
|
||||
}
|
||||
}, [initialRender, postponeExecution]);
|
||||
|
||||
|
|
|
@ -68,5 +68,5 @@ export interface TimeseriesVisProps {
|
|||
indexPattern?: FetchedIndexPattern['indexPattern'];
|
||||
/** @deprecated please use indexPattern.fieldFormatMap instead **/
|
||||
fieldFormatMap?: FieldFormatMap;
|
||||
initialRender: () => void;
|
||||
initialRender: () => void | undefined;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ export function visWithSplits(WrappedComponent) {
|
|||
? findIndex(model.series, (s) => s.id === nonSplitSeries.id)
|
||||
: null;
|
||||
|
||||
const rows = Object.keys(splitsVisData).map((key) => {
|
||||
const rows = Object.keys(splitsVisData).map((key, index, arrayRef) => {
|
||||
const splitData = splitsVisData[key];
|
||||
const { series, label } = splitData;
|
||||
const additionalLabel = label;
|
||||
|
@ -115,7 +115,7 @@ export function visWithSplits(WrappedComponent) {
|
|||
backgroundColor={props.backgroundColor}
|
||||
getConfig={props.getConfig}
|
||||
fieldFormatMap={props.fieldFormatMap}
|
||||
initialRender={props.initialRender}
|
||||
initialRender={arrayRef.length - 1 === index ? props.initialRender : undefined}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -100,7 +100,7 @@ export const TimeSeries = ({
|
|||
const onRenderChange = useCallback(
|
||||
(isRendered) => {
|
||||
if (isRendered) {
|
||||
initialRender();
|
||||
initialRender?.();
|
||||
}
|
||||
},
|
||||
[initialRender]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue