Skip to content

Commit

Permalink
Robustness fix
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Feb 28, 2024
1 parent 88aa083 commit 387a865
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions plugins/MapFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,18 @@ class MapFilter extends React.Component {
if (this.state.geomFilter.geom) {
permalinkState.__geomfilter = this.state.geomFilter.geom.coordinates;
}
permalinkState.__custom = Object.values(this.state.customFilters).filter(entry => entry.active).map(entry => ({
title: entry.title, layer: entry.layer, expr: JSON.parse(entry.expr)
}));
permalinkState.__custom = Object.values(this.state.customFilters).map(entry => {
if (!entry.active) {
return null;
}
let expr = null;
try {
expr = JSON.parse(entry.expr);
} catch (e) {
return null;
}
return {title: entry.title, layer: entry.layer, expr: expr};
}).filter(Boolean);
this.props.setPermalinkParameters({f: JSON.stringify(permalinkState)});
}
}
Expand Down

0 comments on commit 387a865

Please sign in to comment.