@eeacms/volto-arcgis-block 0.1.351 → 0.1.352

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [0.1.352](https://github.com/eea/volto-arcgis-block/compare/0.1.351...0.1.352) - 11 April 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-285178 (bug): Swipe widget loads if coming from dataset catalogue and also auto updates without having to close and open widget manually. [Unai Bolivar - [`2d18dc2`](https://github.com/eea/volto-arcgis-block/commit/2d18dc28cdba2a1056894c70a0ebb06f8bf30c41)]
7
12
  ### [0.1.351](https://github.com/eea/volto-arcgis-block/compare/0.1.350...0.1.351) - 11 April 2025
8
13
 
9
14
  ### [0.1.350](https://github.com/eea/volto-arcgis-block/compare/0.1.349...0.1.350) - 11 April 2025
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.351",
3
+ "version": "0.1.352",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -73,6 +73,7 @@ class SwipeWidget extends React.Component {
73
73
  // and ensure that the component is rendered again
74
74
  this.loadOptions();
75
75
  this.map.layers.on('change', () => {
76
+ this.loadOptions();
76
77
  if (this.hasSwipe) {
77
78
  this.map.layers.removeAll();
78
79
  if (this.swipe.leadingLayers && this.swipe.leadingLayers.items[0]) {
@@ -82,7 +83,6 @@ class SwipeWidget extends React.Component {
82
83
  this.map.layers.add(this.swipe.trailingLayers.items[0]);
83
84
  }
84
85
  }
85
- this.loadOptions();
86
86
  });
87
87
  this.setState({ showMapMenu: true });
88
88
  }
@@ -136,7 +136,31 @@ class SwipeWidget extends React.Component {
136
136
  selectTrailingLayer.options[0].disabled = true;
137
137
  }
138
138
  let cl = JSON.parse(sessionStorage.getItem('checkedLayers'));
139
- if (cl) {
139
+ if (
140
+ (!cl || cl.length === 0) &&
141
+ this.map &&
142
+ this.map.layers &&
143
+ this.map.layers.items.length > 0
144
+ ) {
145
+ cl = [];
146
+ // Find the layer ID in this.layers that corresponds to each map.layers item
147
+ for (const mapLayer of this.map.layers.items) {
148
+ for (const [layerKey, layerObj] of Object.entries(this.layers)) {
149
+ if (layerObj.id === mapLayer.id) {
150
+ cl.push(layerKey);
151
+ break;
152
+ }
153
+ }
154
+ }
155
+
156
+ // Save the newly created checkedLayers to sessionStorage
157
+ if (cl.length > 0) {
158
+ sessionStorage.setItem('checkedLayers', JSON.stringify(cl));
159
+ }
160
+ }
161
+
162
+ // Process the layers
163
+ if (cl && cl.length > 0) {
140
164
  cl.forEach((layer) => {
141
165
  if (this.layers[layer]) {
142
166
  let layerId = this.layers[layer].id;