diff --git a/src/components/CalendarEventModal.tsx b/src/components/CalendarEventModal.tsx index dba61e6..fb899d7 100644 --- a/src/components/CalendarEventModal.tsx +++ b/src/components/CalendarEventModal.tsx @@ -207,6 +207,11 @@ export default function CalendarEventModal({ const locationRequestRef = useRef(0); const locationSearchTimerRef = useRef | null>(null); const locationAbortRef = useRef(null); + const dismissedLocationSuggestionsRef = useRef>(new Set()); + const dismissLocationSuggestion = useCallback((label: string) => { + dismissedLocationSuggestionsRef.current.add(label.toLowerCase()); + setLocationSuggestions(current => current.filter(suggestion => suggestion.label !== label)); + }, []); const dismissLocationSuggestions = useCallback(() => { ++locationRequestRef.current; locationAbortRef.current?.abort(); @@ -244,6 +249,7 @@ export default function CalendarEventModal({ if (requestId !== locationRequestRef.current) return; const mapMatches: LocationSuggestion[] = (data.suggestions || []) .filter((suggestion: any) => suggestion.label) + .filter((suggestion: any) => !dismissedLocationSuggestionsRef.current.has(suggestion.label.toLowerCase())) .map((suggestion: any) => ({ ...suggestion, source: 'openstreetmap' })); const localLabels = new Set(localMatches.map(suggestion => suggestion.label.toLowerCase())); setLocationSuggestions([ @@ -885,7 +891,21 @@ export default function CalendarEventModal({ {suggestion.label} {suggestion.source === 'openstreetmap' && ( - OpenStreetMap + <> + OpenStreetMap + + )} ))}