Skip to content

Commit

Permalink
[data views] Improve preview pane (#126013)
Browse files Browse the repository at this point in the history
* fix preview pane

* fix preview pane

* one less span tag

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
mattkime and kibanamachine authored Feb 21, 2022
1 parent f19a3ac commit 7dbe341
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import React, {
useRef,
FunctionComponent,
} from 'react';
import { renderToString } from 'react-dom/server';
import useDebounce from 'react-use/lib/useDebounce';
import { i18n } from '@kbn/i18n';
import { get } from 'lodash';
Expand Down Expand Up @@ -45,8 +46,10 @@ const defaultParams: Params = {
format: null,
};

export const defaultValueFormatter = (value: unknown) =>
`<span>${typeof value === 'object' ? JSON.stringify(value) : value ?? '-'}</span>`;
export const defaultValueFormatter = (value: unknown) => {
const content = typeof value === 'object' ? JSON.stringify(value) : String(value) ?? '-';
return renderToString(<>{content}</>);
};

export const FieldPreviewProvider: FunctionComponent = ({ children }) => {
const previewCount = useRef(0);
Expand Down

0 comments on commit 7dbe341

Please sign in to comment.