@geogirafe/lib-geoportal 1.3.0-dev.2966299016 → 1.3.0-dev.2970850799

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "GeoGirafe PSC",
6
6
  "url": "https://doc.geogirafe.org"
7
7
  },
8
- "version": "1.3.0-dev.2966299016",
8
+ "version": "1.3.0-dev.2970850799",
9
9
  "type": "module",
10
10
  "engines": {
11
11
  "node": ">=20.19.0"
@@ -1 +1 @@
1
- {"version":"1.3.0-dev.2966299016", "build":"2966299016", "date":"20/10/2026"}
1
+ {"version":"1.3.0-dev.2970850799", "build":"2970850799", "date":"21/10/2026"}
@@ -230,17 +230,6 @@ export default class GeoGirafeApp {
230
230
  console.warn(`The current page is outside of the service worker scope (${registration.scope}), it won't be controlled by the service worker.`);
231
231
  return this.waitForServiceWorkerActivation(registration);
232
232
  }
233
- // The page is not currently controlled by a service worker.
234
- // This can happen, for example, after a force refresh (Ctrl+F5), even though
235
- // an active service worker already exists. In that case, the service worker's
236
- // `activate` event is not triggered again, so the `clients.claim()` call from
237
- // the activation phase cannot take control of this newly loaded page.
238
- // If an active service worker already exists, explicitly ask it to claim the
239
- // current page. The service worker handles this message by calling `clients.claim()`.
240
- const active = registration.active;
241
- if (active) {
242
- active.postMessage({ type: 'claim' });
243
- }
244
233
  // Wait until the service worker takes control of the current page.
245
234
  // Once `clients.claim()` succeeds, the browser updates `sw.controller` and
246
235
  // dispatches the `controllerchange` event.
@@ -251,6 +240,23 @@ export default class GeoGirafeApp {
251
240
  resolve(controller);
252
241
  }
253
242
  }, { once: true });
243
+ // The page is not currently controlled by a service worker.
244
+ // This can happen, for example, after a force refresh (Ctrl+F5), even though
245
+ // an active service worker already exists. In that case, the service worker's
246
+ // `activate` event is not triggered again, so the `clients.claim()` call from
247
+ // the activation phase cannot take control of this newly loaded page.
248
+ // If an active service worker already exists, explicitly ask it to claim the
249
+ // current page. The service worker handles this message by calling `clients.claim()`.
250
+ const active = registration.active;
251
+ if (active) {
252
+ active.postMessage({ type: 'claim' });
253
+ }
254
+ // Safety check: This is exactly the same test as the begining of the method
255
+ // but the worker may have claimed the page before the listener
256
+ // above was registered, in which case `controllerchange` never fires.
257
+ if (sw.controller) {
258
+ resolve(sw.controller);
259
+ }
254
260
  });
255
261
  }
256
262
  async registerServiceWorker() {