Skip to content

Commit

Permalink
Don't refresh snapping feature cache unless drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Mar 19, 2024
1 parent d005c24 commit 707f7d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/map/SnappingSupport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class SnappingSupport extends React.Component {
props.map.getInteractions().on('remove', this.handleInteractionRemoved);
}
componentDidUpdate(prevProps, prevState) {
if (this.props.mapObj.bbox !== prevProps.mapObj.bbox || this.props.theme !== prevProps.theme) {
if (this.state.drawing && (this.props.mapObj.bbox !== prevProps.mapObj.bbox || this.props.theme !== prevProps.theme)) {
this.setState({invalid: true});
this.refreshFeatureCache(true);
} else if (this.props.layers !== prevProps.layers && this.state.havesnaplayers) {
} else if (this.state.drawing && this.props.layers !== prevProps.layers) {
const layersChanged = this.props.layers.find(layer => {
if (layer.role === LayerRole.THEME) {
const prev = prevProps.layers.find(prevLayer => layer.uuid === prevLayer.uuid);
Expand Down Expand Up @@ -185,7 +185,7 @@ class SnappingSupport extends React.Component {
this.setState({drawing: added});
};
refreshFeatureCache = (force) => {
if (!this.state.invalid && !force) {
if (!this.state.invalid && !force || !this.state.drawing) {
return;
}
this.source.clear();
Expand Down

0 comments on commit 707f7d2

Please sign in to comment.