Skip to content

Commit

Permalink
Refactored setSelection to not use previous value
Browse files Browse the repository at this point in the history
  • Loading branch information
neg-0 committed Sep 27, 2023
1 parent a7ab703 commit bf5e21b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,10 @@ function ReportActionItemMessageEdit(props) {
}
setDraft((prevDraft) => {
if (newDraftInput !== newDraft) {
setSelection(() => {
const remainder = ComposerUtils.getCommonSuffixLength(prevDraft, newDraft);
return {
start: newDraft.length - remainder,
end: newDraft.length - remainder,
};
const remainder = ComposerUtils.getCommonSuffixLength(prevDraft, newDraft);
setSelection({
start: newDraft.length - remainder,
end: newDraft.length - remainder,
});
}
return newDraft;
Expand Down

0 comments on commit bf5e21b

Please sign in to comment.