diff --git a/src/plugins/discover/public/plugin.tsx b/src/plugins/discover/public/plugin.tsx index 62fa1553a1a33..7228070fe2d2c 100644 --- a/src/plugins/discover/public/plugin.tsx +++ b/src/plugins/discover/public/plugin.tsx @@ -429,7 +429,6 @@ export class DiscoverPlugin plugins.uiActions.registerTrigger(SEARCH_EMBEDDABLE_CELL_ACTIONS_TRIGGER); injectTruncateStyles(core.uiSettings.get(TRUNCATE_MAX_HEIGHT)); - const getDiscoverServicesInternal = () => this.getDiscoverServices(core, plugins); const isEsqlEnabled = core.uiSettings.get(ENABLE_ESQL); if (plugins.share && this.locator && isEsqlEnabled) { @@ -441,6 +440,10 @@ export class DiscoverPlugin ); } + const getDiscoverServicesInternal = () => { + return this.getDiscoverServices(core, plugins, this.createEmptyProfilesManager()); + }; + return { locator: this.locator, DiscoverContainer: (props: DiscoverContainerProps) => ( @@ -470,7 +473,19 @@ export class DiscoverPlugin ); } - private getDiscoverServices = (core: CoreStart, plugins: DiscoverStartPlugins) => { + private createEmptyProfilesManager() { + return new ProfilesManager( + new RootProfileService(), + new DataSourceProfileService(), + new DocumentProfileService() + ); + } + + private getDiscoverServices = ( + core: CoreStart, + plugins: DiscoverStartPlugins, + profilesManager = this.createProfilesManager() + ) => { return buildServices({ core, plugins, @@ -480,7 +495,7 @@ export class DiscoverPlugin singleDocLocator: this.singleDocLocator!, history: this.historyService.getHistory(), urlTracker: this.urlTracker!, - profilesManager: this.createProfilesManager(), + profilesManager, }); };