Skip to content

Commit 675d118

Browse files
committed
LayerCatalogWidget: fix possible crash when expanding/collapsing groups in filtered catalog
1 parent c637eab commit 675d118

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/widgets/LayerCatalogWidget.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,16 @@ class LayerCatalogWidget extends React.PureComponent {
7979
}
8080
toggleLayerListEntry = (path) => {
8181
this.setState((state) => {
82-
const newCatalog = [...state.catalog];
82+
const catalogKey = this.state.filteredCatalog ? "filteredCatalog" : "catalog";
83+
const newCatalog = [...state[catalogKey]];
8384
newCatalog[path[0]] = {...newCatalog[path[0]]};
8485
let cur = newCatalog[path[0]];
8586
for (const idx of path.slice(1)) {
8687
cur.sublayers[idx] = {...cur.sublayers[idx]};
8788
cur = cur.sublayers[idx];
8889
}
8990
cur.expanded = !cur.expanded;
90-
return {catalog: newCatalog};
91+
return {[catalogKey]: newCatalog};
9192
});
9293
};
9394
render() {

0 commit comments

Comments
 (0)