0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Fix mutating HTMLErrors directly instead of setState

This commit is contained in:
Trevor Buckner
2025-09-09 22:19:43 -04:00
parent 6f2c397574
commit 8a0f350c47

View File

@@ -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 }));
};