-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[unified search] optimize async chunk loading #214483
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
Changes from all commits
827bd17
872d9eb
2a5f117
929fbe1
67cae59
818ae3f
37a1365
5d64a90
e3b3065
14eb1d8
e835416
93a69b0
bc3bca7
c98336c
464e433
bb85ccb
e1bba66
98fc7a7
c3a3489
e338ca8
aff098f
3968c45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ import { | |
| } from '@kbn/data-plugin/public'; | ||
| import type { Filter } from '@kbn/es-query'; | ||
| import type { DataView } from '@kbn/data-views-plugin/public'; | ||
| import { FilterContent } from '../filter_badge'; | ||
| import { FilterContent } from '../../filter_badge'; | ||
|
|
||
| interface Props { | ||
| filters: Filter[]; | ||
|
|
@@ -42,9 +42,7 @@ interface State { | |
| fieldLabel?: string; | ||
| } | ||
|
|
||
| // Needed for React.lazy | ||
| // eslint-disable-next-line import/no-default-export | ||
| export default class ApplyFiltersPopoverContent extends Component<Props, State> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to see this loaded async with the action definition rather than via React lazy. |
||
| export class ApplyFiltersPopoverContent extends Component<Props, State> { | ||
| public static defaultProps = { | ||
| filters: [], | ||
| }; | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,10 @@ export type { DataViewPickerProps } from './data_view_picker'; | |
| * The Lazily-loaded `DataViewsList` component. Consumers should use `React.Suspense` or | ||
| * the withSuspense` HOC to load this component. | ||
| */ | ||
| export const DataViewsListLazy = React.lazy(() => import('./dataview_list')); | ||
| export const DataViewsListLazy = React.lazy(async () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eventually it would be good to have these exported with their own load states rather than forcing the consumer to use suspense and provide a fallback. |
||
| const { DataViewsList } = await import('../ui_module'); | ||
| return { default: DataViewsList }; | ||
| }); | ||
|
|
||
| /** | ||
| * A `DataViewsList` component that is wrapped by the `withSuspense` HOC. This component can | ||
|
|
@@ -29,7 +32,10 @@ export const DataViewsList = withSuspense(DataViewsListLazy); | |
| * The Lazily-loaded `DataViewSelector` component. Consumers should use `React.Suspense` or | ||
| * the withSuspense` HOC to load this component. | ||
| */ | ||
| export const DataViewSelectorLazy = React.lazy(() => import('./data_view_selector')); | ||
| export const DataViewSelectorLazy = React.lazy(async () => { | ||
| const { DataViewSelector } = await import('../ui_module'); | ||
| return { default: DataViewSelector }; | ||
| }); | ||
|
|
||
| /** | ||
| * A `DataViewSelector` component that is wrapped by the `withSuspense` HOC. This component can | ||
|
|
@@ -42,7 +48,10 @@ export const DataViewSelector = withSuspense(DataViewSelectorLazy); | |
| * The Lazily-loaded `DataViewPicker` component. Consumers should use `React.Suspense` or | ||
| * the withSuspense` HOC to load this component. | ||
| */ | ||
| export const DataViewPickerLazy = React.lazy(() => import('./data_view_picker')); | ||
| export const DataViewPickerLazy = React.lazy(async () => { | ||
| const { DataViewPicker } = await import('../ui_module'); | ||
| return { default: DataViewPicker }; | ||
| }); | ||
|
|
||
| /** | ||
| * A `DataViewPicker` component that is wrapped by the `withSuspense` HOC. This component can | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,3 @@ export function FilterBadgeGroup({ | |
| </FilterBadgeErrorBoundary> | ||
| ); | ||
| } | ||
|
|
||
| // Needed for React.lazy | ||
| // eslint-disable-next-line import/no-default-export | ||
| export default FilterBadgeGroup; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great to see the |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this coming down!