fix(react/collections/geomap): react to icon & color changes

This commit is contained in:
Elian Doran 2025-09-13 15:16:58 +03:00
parent 3128f2dace
commit dc854cbd10
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View File

@ -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 });

View File

@ -50,7 +50,7 @@ export default function Marker({ coordinates, icon, draggable, onClick, onDragge
newMarker.addTo(parentMap);
return () => newMarker.removeFrom(parentMap);
}, [ parentMap, coordinates, onMouseDown, onDragged ]);
}, [ parentMap, coordinates, onMouseDown, onDragged, icon ]);
return (<div />)
}