dsh-unlag 1.9.18 → 1.9.20

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 (3) hide show
  1. package/client.js +19 -1
  2. package/index.js +11 -3
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -634,7 +634,25 @@ window.__ModuleLoader__.load({
634
634
  // A replacement that did not finish stops the press here: rebuilding the page anyway would
635
635
  // start a document against a plugin set the app has not finished applying.
636
636
  if (replace) {
637
- const status = await withTimeout(replacePlugins()).catch(() => 'failed');
637
+ /**
638
+ * The answer to a replacement can be lost while the set is being recomposed, which reads
639
+ * as a failure even though the plugins did change. The startup list says which set is
640
+ * serving now, so a lost answer is checked against it before the press claims to fail.
641
+ */
642
+ const before = await hostBootGraph();
643
+ const revBefore = typeof before?.rev === 'string' ? before.rev : null;
644
+ let status = await withTimeout(replacePlugins()).catch(() => 'failed');
645
+ if (status === 'failed' && revBefore !== null) {
646
+ for (const wait of [400, 900, 1800]) { // ui-copy-ignore
647
+ await new Promise((resolve) => setTimeout(resolve, wait));
648
+ const after = await hostBootGraph();
649
+ const revNow = typeof after?.rev === 'string' ? after.rev : null;
650
+ if (revNow !== null && revNow !== revBefore) {
651
+ status = 'done';
652
+ break;
653
+ }
654
+ }
655
+ }
638
656
  if (status !== 'done' && status !== 'off') {
639
657
  const key =
640
658
  status === 'queued'
package/index.js CHANGED
@@ -1532,9 +1532,17 @@ function serveButton(ctx, controller, config) {
1532
1532
  // Which generation of the page came up. A rebuild that lands on older bytes then says so.
1533
1533
  const pageRev = (params.get('rev') ?? '').replace(/[^a-z0-9]/gu, '').slice(0, 24)
1534
1534
  const from = pageRev === '' ? '' : ` (page ${pageRev})`
1535
- if (event === 'mounted') log(`interface rebuilt; the page runs the plugins as served now${from}`)
1536
- else if (event === 'rebuild') log('rebuild allowed: the page re-enters on the served modules')
1537
- else if (event === 'held') log(`rebuild held back: ${gate === '' ? 'unknown' : gate}`)
1535
+ /**
1536
+ * Every outcome the page reports is written down. A press whose line was missing left the
1537
+ * log unable to say what happened; an outcome with no line of its own (a failed
1538
+ * replacement, a press when both switches are off) says so in its own words.
1539
+ */
1540
+ const named = event.replace(/[^a-z-]/gu, '').slice(0, 24)
1541
+ if (named === 'mounted') log(`interface rebuilt; the page runs the plugins as served now${from}`)
1542
+ else if (named === 'rebuild') log('rebuild allowed: the page re-enters on the served modules')
1543
+ else if (named === 'held') log(`rebuild held back: ${gate === '' ? 'unknown' : gate}`)
1544
+ else if (named === '') log('a press reported nothing')
1545
+ else log(`a press ended: ${named}${gate === '' ? '' : ` (${gate})`}${from}`)
1538
1546
  sendJson(res, 200, { status: 'done' })
1539
1547
  } catch (error) {
1540
1548
  log(`cannot record a press report: ${error?.message ?? error}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.18",
3
+ "version": "1.9.20",
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",