mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 22:52:39 +00:00
Fix mutating HTMLErrors directly instead of setState
This commit is contained in:
@@ -126,9 +126,7 @@ const EditPage = (props) => {
|
|||||||
const handleTextChange = (text) => {
|
const handleTextChange = (text) => {
|
||||||
//If there are HTML errors, run the validator on every change to give quick feedback
|
//If there are HTML errors, run the validator on every change to give quick feedback
|
||||||
if(HTMLErrors.length)
|
if(HTMLErrors.length)
|
||||||
HTMLErrors = Markdown.validate(text);
|
setHTMLErrors(Markdown.validate(text));
|
||||||
|
|
||||||
setHTMLErrors(HTMLErrors);
|
|
||||||
setCurrentBrew((prevBrew) => ({ ...prevBrew, text }));
|
setCurrentBrew((prevBrew) => ({ ...prevBrew, text }));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -139,9 +137,7 @@ const EditPage = (props) => {
|
|||||||
const handleSnipChange = (snippet)=>{
|
const handleSnipChange = (snippet)=>{
|
||||||
//If there are HTML errors, run the validator on every change to give quick feedback
|
//If there are HTML errors, run the validator on every change to give quick feedback
|
||||||
if(HTMLErrors.length)
|
if(HTMLErrors.length)
|
||||||
HTMLErrors = Markdown.validate(snippet);
|
setHTMLErrors(Markdown.validate(snippet));
|
||||||
|
|
||||||
setHTMLErrors(HTMLErrors);
|
|
||||||
setCurrentBrew((prevBrew) => ({ ...prevBrew, snippets: snippet }));
|
setCurrentBrew((prevBrew) => ({ ...prevBrew, snippets: snippet }));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user