fixes bug with incoming richText stringified JSON

This commit is contained in:
James
2020-10-05 21:42:47 -04:00
parent 8ce88deda2
commit 3b4875b754

View File

@@ -142,6 +142,10 @@ const RichText = (props) => {
return null;
}
let valueToRender = value;
if (typeof valueToRender === 'string') valueToRender = JSON.parse(valueToRender);
if (!valueToRender) valueToRender = defaultValue;
return (
<div
className={classes}
@@ -163,7 +167,7 @@ const RichText = (props) => {
/>
<Slate
editor={editor}
value={value || defaultValue}
value={valueToRender}
onChange={(val) => {
if (val !== defaultValue && val !== value) {
setValue(val);