Skip to content

Commit

Permalink
Merge pull request #10643 from keymanapp/fix/web/banner-scroll-post-r…
Browse files Browse the repository at this point in the history
…eversion

fix(web): banner scroll positioning after reversions
  • Loading branch information
jahorton authored Feb 7, 2024
2 parents 562aa92 + de1414e commit 16c0628
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default class PredictionContext extends EventEmitter<PredictionContextEve
* @param suggestion Either a `Suggestion` or `Reversion`.
* @returns if `suggestion` is a `Suggestion`, will return a `Promise<Reversion>`; else, `null`.
*/
public accept(suggestion: Suggestion): Promise<Reversion> | null {
public accept(suggestion: Suggestion): Promise<Reversion> | Promise<null> {
let _this = this;

// Selecting a suggestion or a reversion should both clear selection
Expand All @@ -188,7 +188,8 @@ export default class PredictionContext extends EventEmitter<PredictionContextEve
this.recentAccept = false;
this.recentRevert = true;
}
return null;

return Promise.resolve(null);
}

this.revertAcceptancePromise.then(function(suggestion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ describe("PredictionContext", () => {
});

// And now, apply the reversion itself.
let returnValue = predictiveContext.accept(reversion);
let returnValue = await predictiveContext.accept(reversion);

// 'accepting' a reversion performs a rewind; there's no need for async ops here.
assert.isNull(returnValue); // as per the method's spec.
Expand Down

0 comments on commit 16c0628

Please sign in to comment.