The value of the editor is not updated
See original GitHub issueI have an issue in my app where I’m using the editor.
I use the editor in a CMS like applications. There is no issue in the first use of the editor in the app, the init value is correct. But when I change the current “edited page”, the field still displayed the old value (previous edited page). I still can edit the editor, and it’s ok, but the “init value” is wrong.
The value is correctly set as you can see in the screenshot but the value displayed is wrong. I tried many things but I failed to solve this.
Could you help me on that?
Here is a screenshot (as you can see the input above the editor works properly, it’s not a react issue)
Here is the code:
<SimpleMDE
onChange={this.props.setArticleDescription}
value={content.description}
options={{
autoDownloadFontAwesome: false,
hideIcons: [
...
],
spellChecker: false,
status: false
}}
/>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:13 (5 by maintainers)
Top Results From Across the Web
PrimeFaces Editor not updating value - jsf - Stack Overflow
xhtml. Now, if I write something on the editor, the value of the editor is not updated in the backing bean.
Read more >Editing field using list editor does not update va... - ServiceNow
I have an issue regarding List Editor. Changing the value of a field in List Editor in Related List in a Record does...
Read more >Unable to update the data value: Value in the editor is not valid
Hi,. I have a grid with Name. StartDate & Enddate. Ex. Nov.13 01/11/2013 30/11/2013. When i accidentally entered a value for Enddate for ......
Read more >The content of the Editor is not properly updated when the ...
The content of the Editor is not properly updated when the component is hosted in the TelerikForm. If a TelerikEditor and TextArea are...
Read more >New value in inline editor not updating when hitting enter
I have the inline editor extension, and when i edit a field and press enter, the ajax works, it saves the data, but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi,
I ran into the same issue: I think it is realted to
componentDidUpdate
this partthe state is not correctly updated when props change.
A simple trick solved the issue: I provided a
key
attribute with a unique id. Thats makes sure the component is rerendered on props change (I think):<SimpleMDEReact key={unique_id} value={my_value} onChange={value => onChange} />
This bug depends if the component is controlled or uncontrolled and any solutions should test both cases.
I’m using it as a controlled component and fixed the issue by removing all references to state, since it’s not required. I’ll try creating a PR that handles both cases.