(null);
if (!API_KEY) {
return (
Set NEXT_PUBLIC_GOOGLE_MAPS_API_KEY in .env to enable the map.
);
}
// A point can be re-fetched (new object identity) between renders; keep the
// InfoWindow anchored to the latest copy of the same point by id.
const selectedCurrent = selected ? (points.find((p) => p.id === selected.id) ?? selected) : null;
return (
setSelected(null)}
>
{selectedCurrent && setSelected(null)} />}
);
}