fix: map pins update immediately when category filter is cleared
This commit is contained in:
@@ -118,7 +118,7 @@ export default function TripPlannerPage(): React.ReactElement | null {
|
|||||||
|
|
||||||
const [mapCategoryFilter, setMapCategoryFilter] = useState<string>('')
|
const [mapCategoryFilter, setMapCategoryFilter] = useState<string>('')
|
||||||
|
|
||||||
const mapPlaces = useCallback(() => {
|
const mapPlaces = useMemo(() => {
|
||||||
return places.filter(p => {
|
return places.filter(p => {
|
||||||
if (!p.lat || !p.lng) return false
|
if (!p.lat || !p.lng) return false
|
||||||
if (mapCategoryFilter && String(p.category_id) !== String(mapCategoryFilter)) return false
|
if (mapCategoryFilter && String(p.category_id) !== String(mapCategoryFilter)) return false
|
||||||
@@ -376,7 +376,7 @@ export default function TripPlannerPage(): React.ReactElement | null {
|
|||||||
{activeTab === 'plan' && (
|
{activeTab === 'plan' && (
|
||||||
<div style={{ position: 'absolute', inset: 0 }}>
|
<div style={{ position: 'absolute', inset: 0 }}>
|
||||||
<MapView
|
<MapView
|
||||||
places={mapPlaces()}
|
places={mapPlaces}
|
||||||
dayPlaces={dayPlaces}
|
dayPlaces={dayPlaces}
|
||||||
route={route}
|
route={route}
|
||||||
routeSegments={routeSegments}
|
routeSegments={routeSegments}
|
||||||
|
|||||||
Reference in New Issue
Block a user