@@ -24,7 +24,7 @@ import { CANVAS_EMBEDDABLE_CLASSNAME } from '../../../common/lib';
2424const { embeddable : strings } = RendererStrings ;
2525
2626const embeddablesRegistry : {
27- [ key : string ] : IEmbeddable ;
27+ [ key : string ] : IEmbeddable | Promise < IEmbeddable > ;
2828} = { } ;
2929
3030const renderEmbeddableFactory = ( core : CoreStart , plugins : StartDeps ) => {
@@ -67,7 +67,15 @@ export const embeddableRendererFactory = (
6767 throw new EmbeddableFactoryNotFoundError ( embeddableType ) ;
6868 }
6969
70- const embeddableObject = await factory . createFromSavedObject ( input . id , input ) ;
70+ const embeddablePromise = factory
71+ . createFromSavedObject ( input . id , input )
72+ . then ( ( embeddable ) => {
73+ embeddablesRegistry [ uniqueId ] = embeddable ;
74+ return embeddable ;
75+ } ) ;
76+ embeddablesRegistry [ uniqueId ] = embeddablePromise ;
77+
78+ const embeddableObject = await ( async ( ) => embeddablePromise ) ( ) ;
7179
7280 const palettes = await plugins . charts . palettes . getPalettes ( ) ;
7381
@@ -105,8 +113,12 @@ export const embeddableRendererFactory = (
105113 return ReactDOM . unmountComponentAtNode ( domNode ) ;
106114 } ) ;
107115 } else {
108- embeddablesRegistry [ uniqueId ] . updateInput ( input ) ;
109- embeddablesRegistry [ uniqueId ] . reload ( ) ;
116+ const embeddable = embeddablesRegistry [ uniqueId ] ;
117+
118+ if ( 'updateInput' in embeddable ) {
119+ embeddable . updateInput ( input ) ;
120+ embeddable . reload ( ) ;
121+ }
110122 }
111123 } ,
112124 } ) ;
0 commit comments