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
fix(react/collections/geomap): react to icon & color changes
Elian Dorandc854cbd1020
diff --git a/apps/client/src/widgets/collections/geomap/index.tsx b/apps/client/src/widgets/collections/geomap/index.tsxindex b8e80ab794..23432084d4 100644--- a/apps/client/src/widgets/collections/geomap/index.tsx+++ b/apps/client/src/widgets/collections/geomap/index.tsx@@ -168,14 +168,14 @@ function NoteWrapper({ note, isReadOnly }: { note: FNote, isReadOnly: boolean })function NoteMarker({ note, editable, latLng }: { note: FNote, editable: boolean, latLng: [number, number] }) {// React to changes- useNoteLabel(note, "color");- useNoteLabel(note, "iconClass");+ const [ color ] = useNoteLabel(note, "color");+ const [ iconClass ] = useNoteLabel(note, "iconClass");const [ archived ] = useNoteLabelBoolean(note, "archived");const title = useNoteProperty(note, "title");- const colorClass = note.getColorClass();- const iconClass = note.getIcon();- const icon = useMemo(() => buildIcon(iconClass, colorClass ?? undefined, title, note.noteId, archived), [ iconClass, colorClass, title, note.noteId, archived]);+ const icon = useMemo(() => {+ return buildIcon(note.getIcon(), note.getColorClass() ?? undefined, title, note.noteId, archived);+ }, [ iconClass, color, title, note.noteId, archived]);const onClick = useCallback(() => {appContext.triggerCommand("openInPopup", { noteIdOrPath: note.noteId });diff --git a/apps/client/src/widgets/collections/geomap/marker.tsx b/apps/client/src/widgets/collections/geomap/marker.tsxindex 2a2142d1c2..8b6cb13719 100644--- a/apps/client/src/widgets/collections/geomap/marker.tsx+++ b/apps/client/src/widgets/collections/geomap/marker.tsx@@ -50,7 +50,7 @@ export default function Marker({ coordinates, icon, draggable, onClick, onDraggenewMarker.addTo(parentMap);return () => newMarker.removeFrom(parentMap);- }, [ parentMap, coordinates, onMouseDown, onDragged ]);+ }, [ parentMap, coordinates, onMouseDown, onDragged, icon ]);return (<div />)}