mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-29 10:05:53 +08:00
fix(zen-mode): restore input history and watch replay (@byseif21) (#6863)
### Description fix: * The result “input history” panel sometimes rendered nothing because the renderer attempted to split an undefined target word. added split word ?? "" to handle missing target words in zen. * The replay view in zen mode could be empty if the last word was just submitted (so input.current was empty at finish), and the replay words list never got updated. --------- Co-authored-by: Miodec <jack@monkeytype.com>
This commit is contained in:
parent
59a6004de7
commit
1048e04884
2 changed files with 9 additions and 2 deletions
|
@ -904,6 +904,12 @@ export async function finish(difficultyFailed = false): Promise<void> {
|
|||
Replay.replayGetWordsList(TestInput.input.getHistory());
|
||||
}
|
||||
|
||||
// in zen mode, ensure the replay words list reflects the typed input history
|
||||
// even if the current input was empty at finish (e.g., after submitting a word).
|
||||
if (Config.mode === "zen") {
|
||||
Replay.replayGetWordsList(TestInput.input.getHistory());
|
||||
}
|
||||
|
||||
TestInput.forceKeyup(now); //this ensures that the last keypress(es) are registered
|
||||
|
||||
const endAfkSeconds = (now - TestInput.keypressTimings.spacing.last) / 1000;
|
||||
|
|
|
@ -1279,7 +1279,8 @@ async function loadWordsHistory(): Promise<boolean> {
|
|||
throw new Error("empty input word");
|
||||
}
|
||||
|
||||
const errorClass = input !== word ? "error" : "";
|
||||
const errorClass =
|
||||
Config.mode === "zen" ? "" : input !== word ? "error" : "";
|
||||
|
||||
if (corrected !== undefined && corrected !== "") {
|
||||
const correctedChar = !containsKorean
|
||||
|
@ -1297,7 +1298,7 @@ async function loadWordsHistory(): Promise<boolean> {
|
|||
}
|
||||
|
||||
const inputCharacters = Strings.splitIntoCharacters(input);
|
||||
const wordCharacters = Strings.splitIntoCharacters(word);
|
||||
const wordCharacters = Strings.splitIntoCharacters(word ?? "");
|
||||
const correctedCharacters = Strings.splitIntoCharacters(corrected ?? "");
|
||||
|
||||
let loop;
|
||||
|
|
Loading…
Add table
Reference in a new issue