Skip to content

Commit

Permalink
fix type to focus not working after room switch (#1866)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura authored Aug 4, 2024
1 parent cfe893f commit cabfdd4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/features/room/RoomInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
Transforms.insertFragment(editor, msgDraft);
}, [editor, msgDraft]);

useEffect(() => {
if (!mobileOrTablet()) ReactEditor.focus(editor);
return () => {
useEffect(
() => () => {
if (!isEmptyEditor(editor)) {
const parsedDraft = JSON.parse(JSON.stringify(editor.children));
setMsgDraft(parsedDraft);
Expand All @@ -197,8 +196,9 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
}
resetEditor(editor);
resetEditorHistory(editor);
};
}, [roomId, editor, setMsgDraft]);
},
[roomId, editor, setMsgDraft]
);

const handleRemoveUpload = useCallback(
(upload: TUploadContent | TUploadContent[]) => {
Expand Down

0 comments on commit cabfdd4

Please sign in to comment.