mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-22 21:06:58 +00:00
Fix mutating HTMLErrors directly instead of setState
This commit is contained in:
1 parent
6f2c397574
commit
8a0f350c47
1 file changed
+2
-6
@@ -126,9 +126,7 @@ const EditPage = (props) => {
|
||||
const handleTextChange = (text) => {
|
||||
//If there are HTML errors, run the validator on every change to give quick feedback
|
||||
if(HTMLErrors.length)
|
||||
HTMLErrors = Markdown.validate(text);
|
||||
|
||||
setHTMLErrors(HTMLErrors);
|
||||
setHTMLErrors(Markdown.validate(text));
|
||||
setCurrentBrew((prevBrew) => ({ ...prevBrew, text }));
|
||||
};
|
||||
|
||||
@@ -139,9 +137,7 @@ const EditPage = (props) => {
|
||||
const handleSnipChange = (snippet)=>{
|
||||
//If there are HTML errors, run the validator on every change to give quick feedback
|
||||
if(HTMLErrors.length)
|
||||
HTMLErrors = Markdown.validate(snippet);
|
||||
|
||||
setHTMLErrors(HTMLErrors);
|
||||
setHTMLErrors(Markdown.validate(snippet));
|
||||
setCurrentBrew((prevBrew) => ({ ...prevBrew, snippets: snippet }));
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user