Skip to content

Commit

Permalink
Ensure any existing layers get cleared when previewing a new one (#31973
Browse files Browse the repository at this point in the history
) (#31981)
  • Loading branch information
thomasneirynck authored Feb 26, 2019
1 parent a38a2e3 commit d83b640
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ function mapDispatchToProps(dispatch) {
closeFlyout: () => {
dispatch(clearTransientLayerStateAndCloseFlyout());
},
previewLayer: layer => {
previewLayer: async (layer) => {
//this removal always needs to happen prior to adding the new layer
//many source editors allow users to modify the settings in the add-source wizard
//this triggers a new request for preview. Any existing transient layers need to be cleared before the new one can be added.
await dispatch(setSelectedLayer(null));
await dispatch(removeTransientLayer());
dispatch(addLayer(layer.toLayerDescriptor()));
dispatch(setSelectedLayer(layer.getId()));
dispatch(setTransientLayer(layer.getId()));
Expand Down

0 comments on commit d83b640

Please sign in to comment.