|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | import React from 'react'; |
10 | | -import { withSuspense } from '@kbn/shared-ux-utility'; |
11 | 10 |
|
12 | 11 | const Fallback = () => <div />; |
13 | 12 |
|
14 | | -/** |
15 | | - * The Lazily-loaded `FilterBar` component. Consumers should use `React.Suspense` or |
16 | | - * the withSuspense` HOC to load this component. |
17 | | - */ |
18 | | - |
19 | 13 | const LazyFilterBar = React.lazy(() => import('./filter_bar')); |
20 | 14 | export const FilterBar = (props: React.ComponentProps<typeof LazyFilterBar>) => ( |
21 | 15 | <React.Suspense fallback={<Fallback />}> |
22 | 16 | <LazyFilterBar {...props} /> |
23 | 17 | </React.Suspense> |
24 | 18 | ); |
25 | 19 |
|
26 | | -/** |
27 | | - * A `FilterBar` component that is wrapped by the `withSuspense` HOC. This component can |
28 | | - * be used directly by consumers and will load the `FilterBarLazy` component lazily with |
29 | | - * a predefined fallback and error boundary. |
30 | | - */ |
31 | | -// export const FilterBar = withSuspense(FilterBarLazy); |
32 | | - |
33 | | -/** |
34 | | - * The Lazily-loaded `FilterLabel` component. Consumers should use `React.Suspense` or |
35 | | - * the withSuspense` HOC to load this component. |
36 | | - */ |
37 | | -const FilterLabelLazy = React.lazy(() => import('./filter_editor/lib/filter_label')); |
38 | | - |
39 | | -/** |
40 | | - * A `FilterLabel` component that is wrapped by the `withSuspense` HOC. This component can |
41 | | - * be used directly by consumers and will load the `FilterLabelLazy` component lazily with |
42 | | - * a predefined fallback and error boundary. |
43 | | - */ |
44 | | -export const FilterLabel = withSuspense(FilterLabelLazy); |
45 | | - |
46 | | -/** |
47 | | - * The Lazily-loaded `FilterItem` component. Consumers should use `React.Suspense` or |
48 | | - * the withSuspense` HOC to load this component. |
49 | | - */ |
50 | | -const FilterItemLazy = React.lazy(() => import('./filter_item')); |
| 20 | +const LazyFilterLabel = React.lazy(() => import('./filter_editor/lib/filter_label')); |
| 21 | +export const FilterLabel = (props: React.ComponentProps<typeof LazyFilterLabel>) => ( |
| 22 | + <React.Suspense fallback={<Fallback />}> |
| 23 | + <LazyFilterLabel {...props} /> |
| 24 | + </React.Suspense> |
| 25 | +); |
51 | 26 |
|
52 | | -/** |
53 | | - * A `FilterItem` component that is wrapped by the `withSuspense` HOC. This component can |
54 | | - * be used directly by consumers and will load the `FilterItemLazy` component lazily with |
55 | | - * a predefined fallback and error boundary. |
56 | | - */ |
57 | | -export const FilterItem = withSuspense(FilterItemLazy); |
| 27 | +const LazyFilterItem = React.lazy(() => import('./filter_item')); |
| 28 | +export const FilterItem = (props: React.ComponentProps<typeof LazyFilterItem>) => ( |
| 29 | + <React.Suspense fallback={<Fallback />}> |
| 30 | + <LazyFilterItem {...props} /> |
| 31 | + </React.Suspense> |
| 32 | +); |
0 commit comments