mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[ML] Fix Change Point embeddable infinite re-rendering on a dashboard (#184711)
## Summary Closes https://github.com/elastic/kibana/issues/184710 Fixes embeddable rendering by preserving callback refs and memoizing component props.
This commit is contained in:
parent
9c9065d52b
commit
88833a5c76
2 changed files with 9 additions and 5 deletions
|
@ -188,6 +188,10 @@ export const getChangePointChartEmbeddableFactory = (
|
|||
pluginStart
|
||||
);
|
||||
|
||||
const onLoading = (v: boolean) => dataLoading.next(v);
|
||||
const onRenderComplete = () => dataLoading.next(false);
|
||||
const onError = (error: Error) => blockingError.next(error);
|
||||
|
||||
return {
|
||||
api,
|
||||
Component: () => {
|
||||
|
@ -242,9 +246,9 @@ export const getChangePointChartEmbeddableFactory = (
|
|||
maxSeriesToPlot={maxSeriesToPlot}
|
||||
dataViewId={dataViewId}
|
||||
partitions={partitions}
|
||||
onLoading={(v) => dataLoading.next(v)}
|
||||
onRenderComplete={() => dataLoading.next(false)}
|
||||
onError={(error) => blockingError.next(error)}
|
||||
onLoading={onLoading}
|
||||
onRenderComplete={onRenderComplete}
|
||||
onError={onError}
|
||||
embeddingOrigin={embeddingOrigin}
|
||||
lastReloadRequestTime={lastReloadRequestTime}
|
||||
/>
|
||||
|
|
|
@ -17,9 +17,9 @@ export const getChangePointDetectionComponent = (
|
|||
coreStart: CoreStart,
|
||||
pluginStart: AiopsPluginStartDeps
|
||||
): ChangePointDetectionSharedComponent => {
|
||||
return (props) => {
|
||||
return React.memo((props) => {
|
||||
return <ChangePointDetectionLazy coreStart={coreStart} pluginStart={pluginStart} {...props} />;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
export type { ChangePointDetectionSharedComponent } from './change_point_detection';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue