Skip to content

Commit

Permalink
inline kibana_react dependencies in kibana_utils (#66576)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 authored May 15, 2020
1 parent 14fdba4 commit dcbaefd
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/plugins/kibana_utils/public/history/redirect_when_missing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
* under the License.
*/

import React from 'react';
import React, { Fragment } from 'react';
import { History } from 'history';
import { i18n } from '@kbn/i18n';
import ReactDOM from 'react-dom';
import ReactMarkdown from 'react-markdown';

import { ToastsSetup } from 'kibana/public';
import { MarkdownSimple, toMountPoint } from '../../../kibana_react/public';
import { SavedObjectNotFound } from '../errors';

interface Mapping {
Expand Down Expand Up @@ -77,7 +78,19 @@ export function redirectWhenMissing({
title: i18n.translate('kibana_utils.history.savedObjectIsMissingNotificationMessage', {
defaultMessage: 'Saved object is missing',
}),
text: toMountPoint(<MarkdownSimple>{error.message}</MarkdownSimple>),
text: (element: HTMLElement) => {
ReactDOM.render(
<ReactMarkdown
renderers={{
root: Fragment,
}}
>
{error.message}
</ReactMarkdown>,
element
);
return () => ReactDOM.unmountComponentAtNode(element);
},
});

if (onBeforeRedirect) {
Expand Down

0 comments on commit dcbaefd

Please sign in to comment.