@@ -11,13 +11,13 @@ import React, { Component } from 'react';
1111import { FeatureCollection } from 'geojson' ;
1212import { EuiPanel } from '@elastic/eui' ;
1313import { DEFAULT_MAX_RESULT_WINDOW , SCALING_TYPES } from '../../../../common/constants' ;
14- import { getFileUpload } from '../../../kibana_services' ;
1514import { GeoJsonFileSource } from '../../sources/geojson_file_source' ;
1615import { VectorLayer } from '../../layers/vector_layer' ;
1716import { createDefaultLayerDescriptor } from '../../sources/es_search_source' ;
1817import { RenderWizardArguments } from '../../layers/layer_wizard_registry' ;
19- import { FileUploadComponentProps , FileUploadGeoResults } from '../../../../../file_upload/public' ;
18+ import { FileUploadGeoResults } from '../../../../../file_upload/public' ;
2019import { ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/public' ;
20+ import { getFileUploadComponent } from '../../../kibana_services' ;
2121
2222export enum UPLOAD_STEPS {
2323 CONFIGURE_UPLOAD = 'CONFIGURE_UPLOAD' ,
@@ -34,7 +34,6 @@ enum INDEXING_STAGE {
3434
3535interface State {
3636 indexingStage : INDEXING_STAGE ;
37- fileUploadComponent : React . ComponentType < FileUploadComponentProps > | null ;
3837 results ?: FileUploadGeoResults ;
3938}
4039
@@ -43,12 +42,10 @@ export class ClientFileCreateSourceEditor extends Component<RenderWizardArgument
4342
4443 state : State = {
4544 indexingStage : INDEXING_STAGE . CONFIGURE ,
46- fileUploadComponent : null ,
4745 } ;
4846
4947 componentDidMount ( ) {
5048 this . _isMounted = true ;
51- this . _loadFileUploadComponent ( ) ;
5249 }
5350
5451 componentWillUnmount ( ) {
@@ -91,13 +88,6 @@ export class ClientFileCreateSourceEditor extends Component<RenderWizardArgument
9188 this . props . advanceToNextStep ( ) ;
9289 } ) ;
9390
94- async _loadFileUploadComponent ( ) {
95- const fileUploadComponent = await getFileUpload ( ) . getFileUploadComponent ( ) ;
96- if ( this . _isMounted ) {
97- this . setState ( { fileUploadComponent } ) ;
98- }
99- }
100-
10191 _onFileSelect = ( geojsonFile : FeatureCollection , name : string , previewCoverage : number ) => {
10292 if ( ! this . _isMounted ) {
10393 return ;
@@ -157,11 +147,8 @@ export class ClientFileCreateSourceEditor extends Component<RenderWizardArgument
157147 } ;
158148
159149 render ( ) {
160- if ( ! this . state . fileUploadComponent ) {
161- return null ;
162- }
150+ const FileUpload = getFileUploadComponent ( ) ;
163151
164- const FileUpload = this . state . fileUploadComponent ;
165152 return (
166153 < EuiPanel >
167154 < FileUpload
0 commit comments