mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Remove custom plot plugins when Canvas is unmounted (#90722)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
4881306419
commit
20ddd39610
1 changed files with 18 additions and 0 deletions
|
@ -13,6 +13,8 @@ import { i18n } from '@kbn/i18n';
|
|||
import { Provider } from 'react-redux';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
import { includes, remove } from 'lodash';
|
||||
|
||||
import { AppMountParameters, CoreStart, CoreSetup, AppUpdater } from 'kibana/public';
|
||||
|
||||
import { CanvasStartDeps, CanvasSetupDeps } from './plugin';
|
||||
|
@ -39,6 +41,11 @@ import { initFunctions } from './functions';
|
|||
// @ts-expect-error untyped local
|
||||
import { appUnload } from './state/actions/app';
|
||||
|
||||
// @ts-expect-error Not going to convert
|
||||
import { size } from '../canvas_plugin_src/renderers/plot/plugins/size';
|
||||
// @ts-expect-error Not going to convert
|
||||
import { text } from '../canvas_plugin_src/renderers/plot/plugins/text';
|
||||
|
||||
import './style/index.scss';
|
||||
|
||||
const { ReadOnlyBadge: strings } = CapabilitiesStrings;
|
||||
|
@ -147,6 +154,17 @@ export const initializeCanvas = async (
|
|||
export const teardownCanvas = (coreStart: CoreStart, startPlugins: CanvasStartDeps) => {
|
||||
destroyRegistries();
|
||||
|
||||
// Canvas pollutes the jQuery plot plugins collection with custom plugins that only work in Canvas.
|
||||
// Remove them when Canvas is unmounted.
|
||||
// see: ../canvas_plugin_src/renderers/plot/plugins/index.ts
|
||||
if (includes($.plot.plugins, size)) {
|
||||
remove($.plot.plugins, size);
|
||||
}
|
||||
|
||||
if (includes($.plot.plugins, text)) {
|
||||
remove($.plot.plugins, text);
|
||||
}
|
||||
|
||||
// TODO: Not cleaning these up temporarily.
|
||||
// We have an issue where if requests are inflight, and you navigate away,
|
||||
// those requests could still be trying to act on the store and possibly require services.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue