Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

only set a new width if valid (#4380)

Patrick Moulden889bd697ecc5
diff --git a/web/js/components/sidebar/paletteLegend.js b/web/js/components/sidebar/paletteLegend.js
index d6b12723a..9470ce2c5 100644
--- a/web/js/components/sidebar/paletteLegend.js
+++ b/web/js/components/sidebar/paletteLegend.js
@@ -146,7 +146,7 @@ class PaletteLegend extends React.Component {
if (this[ctxStr]) {
const newWidth = this[ctxStr].current.getBoundingClientRect().width;
// eslint-disable-next-line react/destructuring-assignment
- if (newWidth !== this.state.width) {
+ if (newWidth && newWidth !== this.state.width) {
// If scrollbar appears canvas width changes.
// This value is needed for calculating running data offsets
this.setState({ width: newWidth });