Skip to content

Commit

Permalink
Merge pull request #45052 from bernhardoj/fix/44259-cursor-position-r…
Browse files Browse the repository at this point in the history
…eset-to-start-on-refresh

Fix cursor position resets to start of message on page refresh
  • Loading branch information
cristipaval authored Jul 12, 2024
2 parents 6b4665c + 7e3dce3 commit 1048f9a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/Composer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@ function Composer(
}, [shouldClear, onClear]);

useEffect(() => {
setSelection((prevSelection) => {
if (!!prevSelection && selectionProp.start === prevSelection.start && selectionProp.end === prevSelection.end) {
return;
}
return selectionProp;
});
if (!!selection && selectionProp.start === selection.start && selectionProp.end === selection.end) {
return;
}
setSelection(selectionProp);
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [selectionProp]);

/**
Expand Down

0 comments on commit 1048f9a

Please sign in to comment.