Solved a bug with the WriteBlanks warning

This commit is contained in:
Tiago Ribeiro
2024-01-14 22:27:48 +00:00
parent 08aec9b54c
commit 066baa9492

View File

@@ -27,8 +27,8 @@ function Blank({
const [userInput, setUserInput] = useState(userSolution || ""); const [userInput, setUserInput] = useState(userSolution || "");
useEffect(() => { useEffect(() => {
const words = userInput.split(" ").filter((x) => x !== ""); const words = userInput.split(" ");
if (words.length >= maxWords) { if (words.length > maxWords) {
toast.warning(`You have reached your word limit of ${maxWords} words!`, {toastId: "word-limit"}); toast.warning(`You have reached your word limit of ${maxWords} words!`, {toastId: "word-limit"});
setUserInput(words.join(" ").trim()); setUserInput(words.join(" ").trim());
} }