[Bug] `PlotContainer.render` crashes when `center:true` and table does not have geospatial data
@macrigiuseppe is already working on this.
Since Aug 4, 2020.
- Dominant language
- TypeScript
- Stars
- 12k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 66
Description
Describe the bug
Loading a table that does not have geospatial columns results in bounds being null which crashes the PlotContainer
The fix should just be a matter of adding a bounds check before calling geoViewport.viewport (and maybe adding a test case for bounds=null.
const bounds = findMapBounds(mapFields.layers);
const width = size.width / (isSplit ? 2 : 1);
const height = size.height;
const scale = this.mapScaleSelector(this.props);
const newMapState = {
...mapState,
width,
height,
zoom: mapState.zoom + (Math.log2(scale) || 0)
};
if (exportImageSetting.center) {
const {center, zoom} = exportImageSetting.center
? geoViewport.viewport(bounds, [width, height])
: {center: [mapState.longitude, mapState.latitude], zoom: mapState.zoom};
To Reproduce
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.