From 19f61f4b79d37f7975f639f56bdd57a6a49a545e Mon Sep 17 00:00:00 2001 From: soupette Date: Tue, 22 Dec 2020 10:24:36 +0100 Subject: [PATCH] Fix wysiwyg lifecycle Signed-off-by: soupette --- .../admin/src/components/Wysiwyg/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/index.js b/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/index.js index 45d48191f6..4c839d2f38 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/index.js @@ -125,9 +125,19 @@ class Wysiwyg extends React.Component { } // Update the content when used in a dynamiczone + // We cannot update the value of the component each time there is a onChange event + // fired otherwise the component gets very slow if (prevProps.value !== this.props.value && !this.state.isFocused) { this.setInitialValue(this.props); } + + // Here we need to update the content of editorState for the edition case + // With the current architecture of the EditView we cannot rely on the componentDidMount lifecycle + // Since we need to perform some operations in the reducer the loading phase stops before all the operations + // are computed which in some case causes the inputs component to be initialised with a null value. + if (!prevProps.value && this.props.value) { + this.setInitialValue(this.props); + } } /**