Skip to content

Commit

Permalink
Added docs to the lazy plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed May 13, 2021
1 parent 820c2ec commit 57719a3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { EuiLoadingSpinner } from '@elastic/eui';
import React, { Suspense, lazy } from 'react';

// Note: Only use import type/export type here to avoid pulling anything non-lazy into the main plugin and increasing the plugin size
import type { ExceptionBuilderProps } from './exception_items_renderer';
export type { OnChangeProps } from './exception_items_renderer';

Expand All @@ -16,6 +17,11 @@ interface ExtraProps {
idAria: string;
}

/**
* This lazy load allows the exception builder to pull everything out into a plugin chunk.
* You want to be careful of not directly importing/exporting things from exception_items_renderer
* unless you use a import type, and/or a export type to ensure full type erasure
*/
const ExceptionBuilderComponentLazy = lazy(() => import('./exception_items_renderer'));
export const getExceptionBuilderComponentLazy = (
props: ExceptionBuilderProps & ExtraProps
Expand Down

0 comments on commit 57719a3

Please sign in to comment.