From 8755f450c5d008b82a385648a5e94a22dfe01c27 Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 3 Apr 2024 13:35:52 +0200 Subject: [PATCH] fix(word generation): A A or A B A word duplicates could sometimes appear when using lazy mode closes #5238 --- frontend/src/ts/test/words-generator.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/ts/test/words-generator.ts b/frontend/src/ts/test/words-generator.ts index ee9c48157ffa..3bd7ce9286c8 100644 --- a/frontend/src/ts/test/words-generator.ts +++ b/frontend/src/ts/test/words-generator.ts @@ -737,10 +737,11 @@ export async function getNextWord( } else { let regenarationCount = 0; //infinite loop emergency stop button let firstAfterSplit = (randomWord.split(" ")[0] as string).toLowerCase(); + let firstAfterSplitLazy = applyLazyModeToWord(firstAfterSplit, language); while ( regenarationCount < 100 && - (previousWordRaw === firstAfterSplit || - previousWord2Raw === firstAfterSplit || + (previousWordRaw === firstAfterSplitLazy || + previousWord2Raw === firstAfterSplitLazy || (Config.mode !== "custom" && !Config.punctuation && randomWord === "I") || @@ -755,6 +756,7 @@ export async function getNextWord( regenarationCount++; randomWord = wordset.randomWord(funboxFrequency); firstAfterSplit = randomWord.split(" ")[0] as string; + firstAfterSplitLazy = applyLazyModeToWord(firstAfterSplit, language); } } randomWord = randomWord.replace(/ +/g, " ");