diff --git a/apps/nowcasting-app/components/map/deltaMap.tsx b/apps/nowcasting-app/components/map/deltaMap.tsx index ab03f558..a8e5a49c 100644 --- a/apps/nowcasting-app/components/map/deltaMap.tsx +++ b/apps/nowcasting-app/components/map/deltaMap.tsx @@ -152,7 +152,8 @@ const DeltaMap: React.FC = ({ ); map.addSource("latestPV", { type: "geojson", - data: forecastGeoJson + data: forecastGeoJson, + promoteId: "id" }); } else { if (generatedGeoJsonForecastData && source) { diff --git a/apps/nowcasting-app/pages/index.tsx b/apps/nowcasting-app/pages/index.tsx index fd0fd784..82d52786 100644 --- a/apps/nowcasting-app/pages/index.tsx +++ b/apps/nowcasting-app/pages/index.tsx @@ -35,7 +35,7 @@ import { getSitesLoadingState, isProduction } from "../components/helpers/utils"; -import { ActiveUnit } from "../components/map/types"; +import { ActiveUnit, NationalAggregation } from "../components/map/types"; import DeltaMap from "../components/map/deltaMap"; import * as Sentry from "@sentry/nextjs"; import SolarSiteChart from "../components/charts/solar-site-view/solar-site-chart"; @@ -71,6 +71,8 @@ export default function Home({ dashboardModeServer }: { dashboardModeServer: str const [, setSitesLoadingState] = useGlobalState("sitesLoadingState"); const [, setLoadingState] = useGlobalState("loadingState"); const [nHourForecast] = useGlobalState("nHourForecast"); + const [nationalAggregationLevel] = useGlobalState("nationalAggregationLevel"); + const [, setClickedGspId] = useGlobalState("clickedGspId"); const [forecastLastFetch30MinISO, setForecastLastFetch30MinISO] = useState(get30MinNow(-30)); const [forecastHistoricBackwardIntervalMinutes, setForecastHistoricBackwardIntervalMinutes] = @@ -106,6 +108,13 @@ export default function Home({ dashboardModeServer }: { dashboardModeServer: str setArraySettingInCookieStorage(CookieStorageKeys.VISIBLE_LINES, visibleLines); }, [visibleLines]); + // On view change, unset the clicked "GSP" if the aggregation is not GSP + useEffect(() => { + if (nationalAggregationLevel !== NationalAggregation.GSP) { + setClickedGspId(undefined); + } + }, [view]); + const currentView = (v: VIEWS) => v === view; useEffect(() => {