Skip to content

Commit

Permalink
Prevent "Cannot read property 'layers' of undefined" error (#299) (#1910
Browse files Browse the repository at this point in the history
)
  • Loading branch information
igorDykhta committed Aug 9, 2022
1 parent fae2058 commit 486e323
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/reducers/vis-state-updaters.ts
Expand Up @@ -1878,12 +1878,12 @@ export function closeSpecificMapAtIndex<S extends VisState>(
): S {
// retrieve layers meta data from the remaining map that we need to keep
const indexToRetrieve = 1 - action.payload;
const mapLayers = state.splitMaps[indexToRetrieve].layers;
const mapLayers = state.splitMaps[indexToRetrieve]?.layers;
const {layers} = state;

// update layer visibility
const newLayers = layers.map(layer =>
!mapLayers[layer.id] && layer.config.isVisible
mapLayers && !mapLayers[layer.id] && layer.config.isVisible
? layer.updateLayerConfig({
// if layer.id is not in mapLayers, it should be inVisible
isVisible: false
Expand Down

0 comments on commit 486e323

Please sign in to comment.