Skip to content

Commit

Permalink
fix delta gsp selection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
braddf committed Dec 19, 2024
1 parent d75cd7d commit 6731621
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/nowcasting-app/components/map/deltaMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ const DeltaMap: React.FC<DeltaMapProps> = ({
);
map.addSource("latestPV", {
type: "geojson",
data: forecastGeoJson
data: forecastGeoJson,
promoteId: "id"
});
} else {
if (generatedGeoJsonForecastData && source) {
Expand Down
11 changes: 10 additions & 1 deletion apps/nowcasting-app/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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] =
Expand Down Expand Up @@ -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(() => {
Expand Down

0 comments on commit 6731621

Please sign in to comment.