Skip to content

Commit

Permalink
Slim down core bundle (elastic#75912)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
joshdover and elasticmachine committed Sep 28, 2020
1 parent a83d6aa commit 241ff92
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/collapsible_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
import { i18n } from '@kbn/i18n';
import { groupBy, sortBy } from 'lodash';
import React, { Fragment, useRef } from 'react';
import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';
import * as Rx from 'rxjs';
import { ChromeNavLink, ChromeRecentlyAccessedHistoryItem } from '../..';
import { AppCategory } from '../../../../types';
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import { i18n } from '@kbn/i18n';
import classnames from 'classnames';
import React, { createRef, useState } from 'react';
import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';
import { Observable } from 'rxjs';
import { LoadingIndicator } from '../';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/header_breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { EuiHeaderBreadcrumbs } from '@elastic/eui';
import classNames from 'classnames';
import React from 'react';
import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';
import { Observable } from 'rxjs';
import { ChromeBreadcrumb } from '../../chrome_service';

Expand Down
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/header_logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { EuiHeaderLogo } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';
import { Observable } from 'rxjs';
import Url from 'url';
import { ChromeNavLink } from '../..';
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/header_nav_controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { EuiHeaderSectionItem } from '@elastic/eui';
import React from 'react';
import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';
import { Observable } from 'rxjs';
import { ChromeNavControl } from '../../nav_controls';
import { HeaderExtension } from './header_extension';
Expand Down
15 changes: 12 additions & 3 deletions src/core/public/overlays/banners/user_banner_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@

import React, { Fragment } from 'react';
import ReactDOM from 'react-dom';
import ReactMarkdown from 'react-markdown';
import { filter } from 'rxjs/operators';
import { Subscription } from 'rxjs';

import { FormattedMessage } from '@kbn/i18n/react';
import { EuiCallOut, EuiButton } from '@elastic/eui';
import { EuiCallOut, EuiButton, EuiLoadingSpinner } from '@elastic/eui';

import { I18nStart } from '../../i18n';
import { IUiSettingsClient } from '../../ui_settings';
Expand All @@ -36,6 +35,8 @@ interface StartDeps {
uiSettings: IUiSettingsClient;
}

const ReactMarkdownLazy = React.lazy(() => import('react-markdown'));

/**
* Sets up the custom banner that can be specified in advanced settings.
* @internal
Expand Down Expand Up @@ -75,7 +76,15 @@ export class UserBannerService {
}
iconType="help"
>
<ReactMarkdown renderers={{ root: Fragment }}>{content.trim()}</ReactMarkdown>
<React.Suspense
fallback={
<div>
<EuiLoadingSpinner />
</div>
}
>
<ReactMarkdownLazy renderers={{ root: Fragment }} source={content.trim()} />
</React.Suspense>

<EuiButton type="primary" size="s" onClick={() => banners.remove(id!)}>
<FormattedMessage
Expand Down

0 comments on commit 241ff92

Please sign in to comment.