Skip to content

Commit 09b62e6

Browse files
afgomezAlejandro Fernández Gómez
authored andcommitted
fixup! Make the public export lazy
1 parent 4a63279 commit 09b62e6

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

x-pack/plugins/infra/public/components/log_stream/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { useLogStream } from '../../containers/logs/log_stream';
1717

1818
import { ScrollableLogTextStreamView } from '../logging/log_text_stream';
1919

20-
interface LogStreamProps {
20+
export interface LogStreamProps {
2121
sourceId?: string;
2222
startTimestamp: number;
2323
endTimestamp: number;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import React from 'react';
8+
import type { LogStreamProps } from './';
9+
10+
const LazyLogStream = React.lazy(() => import('./'));
11+
12+
export const LazyLogStreamWrapper: React.FC<LogStreamProps> = (props) => (
13+
<React.Suspense fallback={<div />}>
14+
<LazyLogStream {...props} />
15+
</React.Suspense>
16+
);

x-pack/plugins/infra/public/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
import { lazy } from 'react';
76
import { PluginInitializer, PluginInitializerContext } from 'kibana/public';
87
import { Plugin } from './plugin';
98
import {
@@ -28,4 +27,4 @@ export { InfraFormatterType } from './lib/lib';
2827
export type InfraAppId = 'logs' | 'metrics';
2928

3029
// Shared components
31-
export const LogStream = lazy(() => import('./components/log_stream'));
30+
export { LazyLogStreamWrapper as LogStream } from './components/log_stream/lazy_log_stream_wrapper';

0 commit comments

Comments
 (0)