Skip to content

Commit 62ef856

Browse files
committed
chore: add guards to composition
1 parent 34e971b commit 62ef856

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

frontend/src/ts/input/listeners/composition.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as TestLogic from "../../test/test-logic";
55
import { setLastInsertCompositionTextData } from "../state";
66
import * as CompositionDisplay from "../../elements/composition-display";
77
import { onInsertText } from "../handlers/insert-text";
8+
import * as TestUI from "../../test/test-ui";
89

910
const inputEl = getInputElement();
1011

@@ -14,6 +15,7 @@ inputEl.addEventListener("compositionstart", (event) => {
1415
data: event.data,
1516
});
1617

18+
if (TestState.testRestarting || TestUI.resultCalculating) return;
1719
CompositionState.setComposing(true);
1820
CompositionState.setData("");
1921
setLastInsertCompositionTextData("");
@@ -28,14 +30,15 @@ inputEl.addEventListener("compositionupdate", (event) => {
2830
data: event.data,
2931
});
3032

33+
if (TestState.testRestarting || TestUI.resultCalculating) return;
3134
CompositionState.setData(event.data);
3235
CompositionDisplay.update(event.data);
3336
});
3437

3538
inputEl.addEventListener("compositionend", async (event) => {
3639
console.debug("wordsInput event compositionend", { event, data: event.data });
3740

38-
if (TestState.testRestarting) return;
41+
if (TestState.testRestarting || TestUI.resultCalculating) return;
3942
CompositionState.setComposing(false);
4043
CompositionState.setData("");
4144
CompositionDisplay.update("");

0 commit comments

Comments
 (0)