client/note color picker menu item: fix current selection

This commit is contained in:
Adorian Doran 2025-11-18 01:21:26 +02:00
parent 870fef3ea6
commit 87afc64f16

View File

@ -17,13 +17,11 @@ export default function ColorPickerMenuItem(props: ColorPickerMenuItemProps) {
const [note, setNote] = useState<FNote | null>(null);
const [currentColor, setCurrentColor] = useState<string | null>(null);
useEffect(() => {
const retrieveNote = async (noteId: string) => {
const result = await froca.getNote(noteId, true);
if (result) {
setNote(result);
setCurrentColor(result.getLabel("color")?.value ?? "");
}
}
@ -34,6 +32,10 @@ export default function ColorPickerMenuItem(props: ColorPickerMenuItemProps) {
}
}, []);
useEffect(() => {
setCurrentColor(note?.getLabel("color")?.value ?? "");
}, [note]);
const onColorCellClicked = (color: string) => {
if (note) {
attributes.setLabel(note.noteId, "color", color);