Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Trigger Actions UI] Properly unmount app #81436

Merged
merged 3 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ export const boot = (bootDeps: BootDeps) => {
</I18nContext>,
element
);
return () => unmountComponentAtNode(element);
return () => {
unmountComponentAtNode(element);
};
};
19 changes: 9 additions & 10 deletions x-pack/plugins/triggers_actions_ui/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/

import {
CoreStart,
CoreSetup,
PluginInitializerContext,
CoreStart,
Plugin as CorePlugin,
PluginInitializerContext,
} from 'src/core/public';

import { i18n } from '@kbn/i18n';
Expand All @@ -17,10 +17,9 @@ import { registerBuiltInAlertTypes } from './application/components/builtin_aler
import { ActionTypeModel, AlertTypeModel } from './types';
import { TypeRegistry } from './application/type_registry';
import {
ManagementSetup,
ManagementAppMountParams,
ManagementSetup,
} from '../../../../src/plugins/management/public';
import { boot } from './application/boot';
import { ChartsPluginStart } from '../../../../src/plugins/charts/public';
import { PluginStartContract as AlertingStart } from '../../alerts/public';
import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
Expand Down Expand Up @@ -63,11 +62,9 @@ export class Plugin
private initializerContext: PluginInitializerContext;

constructor(initializerContext: PluginInitializerContext) {
const actionTypeRegistry = new TypeRegistry<ActionTypeModel>();
this.actionTypeRegistry = actionTypeRegistry;
this.actionTypeRegistry = new TypeRegistry<ActionTypeModel>();

const alertTypeRegistry = new TypeRegistry<AlertTypeModel>();
this.alertTypeRegistry = alertTypeRegistry;
this.alertTypeRegistry = new TypeRegistry<AlertTypeModel>();

this.initializerContext = initializerContext;
}
Expand All @@ -88,7 +85,10 @@ export class Plugin
PluginsStart,
unknown
];
boot({

const { boot } = await import('./application/boot');

return boot({
dataPlugin: pluginsStart.data,
charts: pluginsStart.charts,
alerts: pluginsStart.alerts,
Expand All @@ -107,7 +107,6 @@ export class Plugin
actionTypeRegistry,
alertTypeRegistry,
});
return () => {};
},
});

Expand Down