From af8862c8c9538695e33a4f126bbc7a25ff356d54 Mon Sep 17 00:00:00 2001 From: Erwan Leboucher Date: Fri, 28 Aug 2026 10:12:33 +0200 Subject: [PATCH 1/2] fix: prevent color picker jitter --- .../features/settings/account/NameColorEditor.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/features/settings/account/NameColorEditor.tsx b/src/app/features/settings/account/NameColorEditor.tsx index bfd6557f28..66bc645bb9 100644 --- a/src/app/features/settings/account/NameColorEditor.tsx +++ b/src/app/features/settings/account/NameColorEditor.tsx @@ -36,6 +36,7 @@ export function NameColorEditor({ const [tempColor, setTempColor] = useState( stripQuotes(newNameColor) || stripQuotes(current) || undefined ); + const [pickerColor, setPickerColor] = useState(tempColor ?? '#FFFFFF'); const [hasChanged, setHasChanged] = useState(false); useEffect(() => { @@ -50,6 +51,10 @@ export function NameColorEditor({ setHasChanged(newNameColor !== current); }, [newNameColor, current]); + useEffect(() => { + if (tempColor && isValidHex(tempColor)) setPickerColor(tempColor); + }, [tempColor]); + // Valid in the sense that it should look like an error during input. // It's disruptive to the user to immediately present their input as an error. // We should only present an error if they fail the regex test :) @@ -117,7 +122,15 @@ export function NameColorEditor({ )} } + picker={ + { + setPickerColor(newColor); + handleUpdate(newColor); + }} + /> + } > {(onOpen, opened) => ( )} - { - setPickerColor(newColor); - handleUpdate(newColor); - }} - /> - } - > + {(onOpen, opened) => (