mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Canvas] Fix reports embeddables (#93482)
* wip * WIP Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
572f6888c2
commit
d673f5601d
1 changed files with 16 additions and 4 deletions
|
@ -24,7 +24,7 @@ import { CANVAS_EMBEDDABLE_CLASSNAME } from '../../../common/lib';
|
|||
const { embeddable: strings } = RendererStrings;
|
||||
|
||||
const embeddablesRegistry: {
|
||||
[key: string]: IEmbeddable;
|
||||
[key: string]: IEmbeddable | Promise<IEmbeddable>;
|
||||
} = {};
|
||||
|
||||
const renderEmbeddableFactory = (core: CoreStart, plugins: StartDeps) => {
|
||||
|
@ -67,7 +67,15 @@ export const embeddableRendererFactory = (
|
|||
throw new EmbeddableFactoryNotFoundError(embeddableType);
|
||||
}
|
||||
|
||||
const embeddableObject = await factory.createFromSavedObject(input.id, input);
|
||||
const embeddablePromise = factory
|
||||
.createFromSavedObject(input.id, input)
|
||||
.then((embeddable) => {
|
||||
embeddablesRegistry[uniqueId] = embeddable;
|
||||
return embeddable;
|
||||
});
|
||||
embeddablesRegistry[uniqueId] = embeddablePromise;
|
||||
|
||||
const embeddableObject = await (async () => embeddablePromise)();
|
||||
|
||||
const palettes = await plugins.charts.palettes.getPalettes();
|
||||
|
||||
|
@ -105,8 +113,12 @@ export const embeddableRendererFactory = (
|
|||
return ReactDOM.unmountComponentAtNode(domNode);
|
||||
});
|
||||
} else {
|
||||
embeddablesRegistry[uniqueId].updateInput(input);
|
||||
embeddablesRegistry[uniqueId].reload();
|
||||
const embeddable = embeddablesRegistry[uniqueId];
|
||||
|
||||
if ('updateInput' in embeddable) {
|
||||
embeddable.updateInput(input);
|
||||
embeddable.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue