Skip to content

Commit

Permalink
fix: prevent error when cSpec is undefined in Chart component during …
Browse files Browse the repository at this point in the history
…render
  • Loading branch information
Kevin Koech authored and Kevin Koech committed Feb 4, 2025
1 parent 7951542 commit e1171fd
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ function Chart({

useEffect(() => {
try {
const viewProp = new vega.View(vega.parse(cSpec), { renderer: "none" });
setDownloadView(viewProp);
if (cSpec) {
const viewProp = new vega.View(vega.parse(cSpec), { renderer: "none" });
setDownloadView(viewProp);
}
} catch (error) {
console.error("Error creating view", error);

Check warning on line 117 in apps/climatemappedafrica/src/components/HURUmap/Chart/index.js

View workflow job for this annotation

GitHub Actions / Build and Test (20.16, ubuntu-latest)

Unexpected console statement
}
Expand Down

0 comments on commit e1171fd

Please sign in to comment.