Skip to content

Commit

Permalink
fixup! Make the public export lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
afgomez authored and Alejandro Fernández Gómez committed Sep 4, 2020
1 parent 4a63279 commit 09b62e6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useLogStream } from '../../containers/logs/log_stream';

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

interface LogStreamProps {
export interface LogStreamProps {
sourceId?: string;
startTimestamp: number;
endTimestamp: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React from 'react';
import type { LogStreamProps } from './';

const LazyLogStream = React.lazy(() => import('./'));

export const LazyLogStreamWrapper: React.FC<LogStreamProps> = (props) => (
<React.Suspense fallback={<div />}>
<LazyLogStream {...props} />
</React.Suspense>
);
3 changes: 1 addition & 2 deletions x-pack/plugins/infra/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { lazy } from 'react';
import { PluginInitializer, PluginInitializerContext } from 'kibana/public';
import { Plugin } from './plugin';
import {
Expand All @@ -28,4 +27,4 @@ export { InfraFormatterType } from './lib/lib';
export type InfraAppId = 'logs' | 'metrics';

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

0 comments on commit 09b62e6

Please sign in to comment.