dsh-unlag 1.9.28 → 1.9.30

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.
Files changed (2) hide show
  1. package/client.js +18 -1
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -360,10 +360,15 @@ window.__ModuleLoader__.load({
360
360
  if (live === null) return held('graph');
361
361
  const kept = Array.isArray(frozen.entries) ? frozen.entries : [];
362
362
  const liveIds = new Set((Array.isArray(live.entries) ? live.entries : []).map((entry) => (typeof entry === 'string' ? entry : entry?.id)));
363
+ let vanished = false;
363
364
  for (const entry of kept) {
364
365
  const id = typeof entry === 'string' ? entry : entry?.id;
365
- if (typeof id === 'string' && id !== '' && !liveIds.has(id)) return held('plugin');
366
+ if (typeof id === 'string' && id !== '' && !liveIds.has(id)) vanished = true;
366
367
  }
368
+ // A plugin switched off since this page booted is only fatal if nothing stands in for its
369
+ // script. Such a row is answered with an empty body and the check below reads it back the
370
+ // same way, so the press may ask instead of being refused here for good.
371
+ if (vanished && (await hostShimAnswersGone())) return held('plugin');
367
372
  }
368
373
  const verdict = await hostVerifyStartup(scripts);
369
374
  if (verdict !== 'ok') return false;
@@ -426,6 +431,18 @@ window.__ModuleLoader__.load({
426
431
  }
427
432
  }
428
433
 
434
+ /** Whether a plugin no longer in the running set still has its script answered. */
435
+ async function hostShimAnswersGone() {
436
+ try {
437
+ const response = await withTimeout(fetch(`${HOST_BASE}/state`, { cache: 'no-store', credentials: 'same-origin' }));
438
+ if (!response.ok) return true;
439
+ const data = await withTimeout(response.json());
440
+ return data?.shim?.wrapped !== true;
441
+ } catch {
442
+ return true;
443
+ }
444
+ }
445
+
429
446
  async function servedBootGraph() {
430
447
  const fromHost = await hostBootGraph();
431
448
  if (fromHost !== null) return fromHost;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.28",
3
+ "version": "1.9.30",
4
4
  "type": "module",
5
5
  "description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
6
6
  "license": "MIT",