Skip to content

Commit f99181f

Browse files
authored
Fixed useUnsetCursorPositionOnBlur not hiding cursors.
`useUnsetCursorPositionOnBlur` does not hide cursors when the remote editor blurs. This happens because `useUnsetCursorPositionOnBlur` only sets the cursor state field to `null` on blur, but does not set the client data field to `null`, which prevents the client from being deleted from the awareness state. One possible fix is to delete both fields on blur. Another possible fix (this PR) is to remove the cursor if the selection range gets deleted.
1 parent 17947af commit f99181f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react/src/hooks/useRemoteCursorStateStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function createRemoteCursorStateStore<
5252

5353
changed.forEach((clientId) => {
5454
const state = CursorEditor.cursorState(editor, clientId);
55-
if (state === null) {
55+
if (state === null || state.relativeSelection === null) {
5656
delete cursors[clientId.toString()];
5757
return;
5858
}

0 commit comments

Comments
 (0)