Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/note color picker menu item: fix current selection
Adorian Doran87afc64f16c8
diff --git a/apps/client/src/menus/custom-items/ColorPickerMenuItem.tsx b/apps/client/src/menus/custom-items/ColorPickerMenuItem.tsxindex b9e6d876ad..030a853e4c 100644--- a/apps/client/src/menus/custom-items/ColorPickerMenuItem.tsx+++ b/apps/client/src/menus/custom-items/ColorPickerMenuItem.tsx@@ -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);