Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 (grapher) guard against undefined #3284

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Mar 4, 2024

Baking fails for chart sources-population-dataset with the following error message:

TypeError: Cannot read properties of undefined (reading 'toFixed')
_HorizontalAxis.place (/home/owid/owid-grapher/packages/@ourworldindata/grapher/src/axis/Axis.ts:387:46)
<anonymous> (/home/owid/owid-grapher/packages/@ourworldindata/grapher/src/barCharts/DiscreteBarChart.tsx:471:33)
Array.map (<anonymous>)
DiscreteBarChart.render (/home/owid/owid-grapher/packages/@ourworldindata/grapher/src/barCharts/DiscreteBarChart.tsx:462:25)
Object.allowStateChanges [as _allowStateChanges] (/home/owid/owid-grapher/node_modules/mobx/lib/mobx.js:991:15)
/home/owid/owid-grapher/node_modules/mobx-react/index.js:851:28
trackDerivedFunction (/home/owid/owid-grapher/node_modules/mobx/lib/mobx.js:776:24)
Reaction.track (/home/owid/owid-grapher/node_modules/mobx/lib/mobx.js:1806:22)
DiscreteBarChart.reactiveRender [as render] (/home/owid/owid-grapher/node_modules/mobx-react/index.js:845:16)
DiscreteBarChart.makeComponentReactive (/home/owid/owid-grapher/node_modules/mobx-react/index.js:915:27)

Guarding against undefined when placing the value on the axis "fixes" this, but it's not clear to me why DiscreteBar chart is even rendered for the chart in question. https://ourworldindata.org/grapher/sources-population-dataset doesn't have a chart tab and is, in theory, a line chart

Copy link
Member Author

sophiamersmann commented Mar 4, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @sophiamersmann and the rest of your teammates on Graphite Graphite

@sophiamersmann sophiamersmann force-pushed the axis-undefined-placement branch 2 times, most recently from d21371d to 7278773 Compare March 4, 2024 12:47
@sophiamersmann sophiamersmann changed the base branch from master to fix-horizontal-axis-view March 4, 2024 12:47
@sophiamersmann sophiamersmann marked this pull request as ready for review March 4, 2024 12:48
Copy link
Member Author

sophiamersmann commented Mar 4, 2024

Merge activity

Base automatically changed from fix-horizontal-axis-view to master March 4, 2024 13:34
@sophiamersmann sophiamersmann force-pushed the axis-undefined-placement branch from 7278773 to 8ee6bb0 Compare March 4, 2024 13:35
@sophiamersmann sophiamersmann merged commit dfa37c0 into master Mar 4, 2024
14 of 17 checks passed
@sophiamersmann sophiamersmann deleted the axis-undefined-placement branch March 4, 2024 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant