From e8d05db4d36986fdffec23faf95c35d48fa5b1a4 Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Mon, 27 Mar 2023 11:56:02 +0700 Subject: [PATCH] chore(web): Apply suggestions from code review Co-authored-by: Marc Durdin --- .../input-processor/src/text/prediction/languageProcessor.ts | 2 +- .../input-processor/src/text/prediction/predictionContext.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/common/web/input-processor/src/text/prediction/languageProcessor.ts b/common/web/input-processor/src/text/prediction/languageProcessor.ts index f7c7d5d3e5..9143a2e77e 100644 --- a/common/web/input-processor/src/text/prediction/languageProcessor.ts +++ b/common/web/input-processor/src/text/prediction/languageProcessor.ts @@ -68,7 +68,7 @@ interface LanguageProcessorEventMap { 'tryrevert': () => void, /** - * Is called synchronously as part of suggestion application when successful. + * Is called synchronously once suggestion application is successful and the context has been updated. * * @param outputTarget The `OutputTarget` representation of the context the suggestion was applied to. * @returns diff --git a/common/web/input-processor/src/text/prediction/predictionContext.ts b/common/web/input-processor/src/text/prediction/predictionContext.ts index 9fc5dcd003..aefa60cb10 100644 --- a/common/web/input-processor/src/text/prediction/predictionContext.ts +++ b/common/web/input-processor/src/text/prediction/predictionContext.ts @@ -77,9 +77,8 @@ export default class PredictionContext extends EventEmitter boolean = () => { - return this.currentTarget && langProcessor.state == 'configured'; - } + const validSuggestionState: () => boolean = () => + this.currentTarget && langProcessor.state == 'configured'; this.suggestionApplier = (suggestion) => { if(validSuggestionState()) {