From 273032f45a96b30bf20843814376edeb48b5cdc0 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Tue, 22 May 2018 16:07:09 -0700 Subject: [PATCH] fix: send an object to text renderer rather than the text itself (#614) --- common/types/boolean.js | 3 ++- common/types/number.js | 3 ++- common/types/string.js | 4 ++-- public/render_functions/text.js | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/types/boolean.js b/common/types/boolean.js index a82016339b56bf..905f98f807bd0b 100644 --- a/common/types/boolean.js +++ b/common/types/boolean.js @@ -9,10 +9,11 @@ export const boolean = () => ({ string: n => String(n), number: n => Number(n), render: value => { + const text = `${value}`; return { type: 'render', as: 'text', - value: `${value}`, + value: { text }, }; }, }, diff --git a/common/types/number.js b/common/types/number.js index 3ee7748c11bc6b..665d386a08d7b3 100644 --- a/common/types/number.js +++ b/common/types/number.js @@ -7,10 +7,11 @@ export const number = () => ({ to: { string: n => String(n), render: value => { + const text = `${value}`; return { type: 'render', as: 'text', - value: `${value}`, + value: { text }, }; }, datatable: value => { diff --git a/common/types/string.js b/common/types/string.js index 1dc3ce1c6dbcf8..efd93d897b249f 100644 --- a/common/types/string.js +++ b/common/types/string.js @@ -6,11 +6,11 @@ export const string = () => ({ }, to: { number: n => Number(n), - render: value => { + render: text => { return { type: 'render', as: 'text', - value, + value: { text }, }; }, }, diff --git a/public/render_functions/text.js b/public/render_functions/text.js index 3ec770e7d04a2a..a884e7376d42af 100644 --- a/public/render_functions/text.js +++ b/public/render_functions/text.js @@ -6,8 +6,8 @@ export const text = () => ({ displayName: 'Plain Text', help: 'Render output as plain text', reuseDomNode: true, - render(domNode, config, handlers) { - ReactDOM.render(
{config}
, domNode, () => handlers.done()); + render(domNode, { text }, handlers) { + ReactDOM.render(
{text}
, domNode, () => handlers.done()); handlers.onDestroy(() => ReactDOM.unmountComponentAtNode(domNode)); }, });