Skip to content

Commit

Permalink
Prevent and log errors in case population was not found
Browse files Browse the repository at this point in the history
  • Loading branch information
lemilonkh committed Mar 19, 2024
1 parent 6ed29a6 commit 5c7cdfc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/app/[lng]/onboarding/setup/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ function SetupStep({
useEffect(() => {
if (cityData) {
const population = findClosestYear(cityData?.data.population, year);
if (!population) {
console.error("Failed to find population data for city");
console.log("pop data", cityData?.data.population);
return;
}
const newPopulation = {
...populationData,
year: population?.year,
Expand Down Expand Up @@ -295,7 +300,7 @@ function SetupStep({
{isLoading && <p className="px-4">Fetching Cities...</p>}
{isSuccess &&
cities &&
cities.map((city: any) => {
cities.map((city: OCCityAttributes) => {
return (
<Box
onClick={() => handleSetCity(city)}
Expand Down

0 comments on commit 5c7cdfc

Please sign in to comment.