* wip * WIP Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
0897999f91
commit
0a7b8cad18
|
@ -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…
Reference in a new issue