From f7095584a85c4d3675a24a0d3f67f7c5b57ef4f3 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 9 Dec 2023 11:11:20 +0200 Subject: [PATCH] Focus text area when editing public note Closes #1592 --- app/features/sendouq/components/GroupCard.tsx | 105 +++++++++++------- 1 file changed, 63 insertions(+), 42 deletions(-) diff --git a/app/features/sendouq/components/GroupCard.tsx b/app/features/sendouq/components/GroupCard.tsx index e2057ad42..5befe5858 100644 --- a/app/features/sendouq/components/GroupCard.tsx +++ b/app/features/sendouq/components/GroupCard.tsx @@ -321,56 +321,20 @@ function MemberNote({ editable: boolean; }) { const { t } = useTranslation(["common", "q"]); - const fetcher = useFetcher(); const [editing, setEditing] = React.useState(false); - const [value, setValue] = React.useState(note ?? ""); - const startEditing = () => setEditing(true); - const stopEditing = React.useCallback(() => { - setEditing(false); - setValue(note ?? ""); - }, [note]); + const startEditing = () => { + setEditing(true); + }; // when note updates exit editing mode React.useEffect(() => { - stopEditing(); - }, [stopEditing]); - - const newValueLegal = value.length <= SENDOUQ.OWN_PUBLIC_NOTE_MAX_LENGTH; + setEditing(false); + }, [note]); if (editing) { return ( - -