dsh-unlag 1.9.55 → 1.9.56

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 +24 -2
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -432,6 +432,22 @@ window.__ModuleLoader__.load({
432
432
  }
433
433
  }
434
434
 
435
+ /**
436
+ * The stamp written when the plugin code was last loaded. A replacement that was applied
437
+ * without changing which bundles are served keeps the startup list's revision, so the graph
438
+ * alone cannot tell a lost answer from a failed press; the code stamp can.
439
+ */
440
+ async function hostCodeStamp() {
441
+ try {
442
+ const response = await withTimeout(fetch(`${HOST_BASE}/state`, { cache: 'no-store', credentials: 'same-origin' }));
443
+ if (!response.ok) return null;
444
+ const data = await withTimeout(response.json());
445
+ return typeof data?.code === 'string' ? data.code : null;
446
+ } catch {
447
+ return null;
448
+ }
449
+ }
450
+
435
451
  /** Whether a plugin no longer in the running set still has its script answered. */
436
452
  async function hostShimAnswersGone() {
437
453
  try {
@@ -683,13 +699,19 @@ window.__ModuleLoader__.load({
683
699
  */
684
700
  const before = await hostBootGraph();
685
701
  const revBefore = typeof before?.rev === 'string' ? before.rev : null;
702
+ const codeBefore = await hostCodeStamp();
686
703
  let status = await withTimeout(replacePlugins()).catch(() => 'failed');
687
- if (status === 'failed' && revBefore !== null) {
704
+ if (status === 'failed' && (revBefore !== null || codeBefore !== null)) {
688
705
  for (const wait of [400, 900, 1800]) { // ui-copy-ignore
689
706
  await new Promise((resolve) => setTimeout(resolve, wait));
690
707
  const after = await hostBootGraph();
691
708
  const revNow = typeof after?.rev === 'string' ? after.rev : null;
692
- if (revNow !== null && revNow !== revBefore) {
709
+ if (revNow !== null && revBefore !== null && revNow !== revBefore) {
710
+ status = 'done';
711
+ break;
712
+ }
713
+ const codeNow = await hostCodeStamp();
714
+ if (codeNow !== null && codeBefore !== null && codeNow !== codeBefore) {
693
715
  status = 'done';
694
716
  break;
695
717
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.55",
3
+ "version": "1.9.56",
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",