dsh-unlag 1.9.33 → 1.9.35

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 +7 -4
  2. package/index.js +15 -0
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -6,8 +6,8 @@ window.__ModuleLoader__.load({
6
6
 
7
7
  const zh = /^zh/i.test(navigator.language || '');
8
8
  const COPY = zh
9
- ? { label: '解除卡顿', hint: '卡顿时用:换掉插件代码并重建界面;运行中的任务、排队的消息保留', blocked: '暂时无法重建界面,稍后再试', unsaved: '有未保存的改动,先保存再重试', dialog: '先关闭打开的窗口再重载', queued: '更新已排队,稍后再按一次', applying: '还在应用这次更新,稍后再按一次', off: '两个开关都关着,先在设置里打开一个', replaced: '插件代码已更新,页面保持不动', done: '插件代码已是最新', restart: '这次改动要重新打开应用才会生效', failed: '插件更新没完成,稍后再按一次' } // ui-copy-ignore
10
- : { label: 'Unlag', hint: 'For a sluggish interface: replaces plugin code and rebuilds the page; running turns and queued messages are kept', blocked: 'Cannot rebuild the page right now; try again', unsaved: 'Unsaved changes; save them, then retry', dialog: 'Close the open window first', queued: 'Update queued; press again shortly', applying: 'Still applying this update; press again shortly', off: 'Both switches are off; turn one on in settings', replaced: 'Plugin code updated; the page stayed as it is', done: 'Plugin code is already up to date', restart: 'This change needs the app reopened before it can apply', failed: 'The plugin update did not finish; press again later' };
9
+ ? { label: '解除卡顿', hint: '卡顿时用:换掉插件代码并重建界面;运行中的任务、排队的消息保留', blocked: '暂时无法重建界面,稍后再试', unsaved: '有未保存的改动,先保存再重试', dialog: '先关闭打开的窗口再重载', queued: '更新已排队,稍后再按一次', applying: '还在应用这次更新,稍后再按一次', off: '两个开关都关着,先在设置里打开一个', replaced: '插件代码已更新,页面保持不动', stayedReplaced: '插件代码已更新,页面没有重建;稍后再按一次', stayed: '页面没有重建;稍后再按一次', done: '插件代码已是最新', restart: '这次改动要重新打开应用才会生效', failed: '插件更新没完成,稍后再按一次' } // ui-copy-ignore
10
+ : { label: 'Unlag', hint: 'For a sluggish interface: replaces plugin code and rebuilds the page; running turns and queued messages are kept', blocked: 'Cannot rebuild the page right now; try again', unsaved: 'Unsaved changes; save them, then retry', dialog: 'Close the open window first', queued: 'Update queued; press again shortly', applying: 'Still applying this update; press again shortly', off: 'Both switches are off; turn one on in settings', replaced: 'Plugin code updated; the page stayed as it is', stayedReplaced: 'Plugin code updated; the page did not rebuild; press again shortly', stayed: 'The page did not rebuild; press again shortly', done: 'Plugin code is already up to date', restart: 'This change needs the app reopened before it can apply', failed: 'The plugin update did not finish; press again later' };
11
11
 
12
12
  /**
13
13
  * Why the interface was left as it is, in words a person can act on. The checks below record
@@ -642,6 +642,8 @@ window.__ModuleLoader__.load({
642
642
  setPending(true);
643
643
  setNotice(null);
644
644
  let navigated = false;
645
+ // Read by the fallback below, which runs after the try block's own scope is gone.
646
+ let replaced = false;
645
647
  const stop = (key, applied = false) => {
646
648
  setPending(false);
647
649
  setNotice(noticeFor(key, applied));
@@ -650,7 +652,6 @@ window.__ModuleLoader__.load({
650
652
  const settings = await readSettings();
651
653
  const replace = settings === null ? false : settings.plugins;
652
654
  const rebuild = settings === null ? true : settings.page;
653
- let replaced = false;
654
655
  // Nothing is switched on: the press says so instead of looking broken.
655
656
  if (!replace && !rebuild) {
656
657
  report('off');
@@ -726,7 +727,9 @@ window.__ModuleLoader__.load({
726
727
  // happened and take the press back, so the button is never left unresponsive.
727
728
  report('held', 'navigation');
728
729
  setPending(false);
729
- setNotice(noticeFor('replaced'));
730
+ // Only a press that really replaced the plugins may say so: a page-only press that
731
+ // held the navigation changed no code.
732
+ setNotice(replaced ? COPY.stayedReplaced : COPY.stayed);
730
733
  }, 6000); // ui-copy-ignore
731
734
  }
732
735
  }
package/index.js CHANGED
@@ -371,6 +371,8 @@ function pluginReloader(ctx, config) {
371
371
  request.then(settle, settle)
372
372
  return request
373
373
  }
374
+ /** Whether the bundle route was wrapped when this update started, so a re-wrap is written down. */
375
+ const shimWrappedBefore = bundleShimStatus(ctx).wrapped
374
376
  let result = null
375
377
  for (let attempt = 0; ; attempt += 1) {
376
378
  try {
@@ -391,6 +393,19 @@ function pluginReloader(ctx, config) {
391
393
  throw error
392
394
  }
393
395
  }
396
+ /**
397
+ * A recomposition can leave the bundle route owned by a fresh handler. A page started from the
398
+ * launch-time list is then answered by the app's own 404 for a stale set, and the desktop shell
399
+ * treats such an entry as fatal — it exits and takes every running turn with it. Wrapping again
400
+ * here means the time between an update and the next press is never left unwrapped.
401
+ */
402
+ try {
403
+ ensureBundleShim(ctx)
404
+ if (bundleShimStatus(ctx).wrapped !== true) log('the bundle route is not wrapped after the update; a page started now may not boot')
405
+ else if (shimWrappedBefore !== true) log('the bundle route was wrapped again after the update')
406
+ } catch (error) {
407
+ log(`cannot wrap the bundle route after the update: ${error?.message ?? error}`)
408
+ }
394
409
  const warnings = Array.isArray(result?.warnings) ? result.warnings : []
395
410
  const pending = Array.isArray(result?.pending) ? result.pending : []
396
411
  const restartReason = typeof result?.restartReason === 'string' ? result.restartReason : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.33",
3
+ "version": "1.9.35",
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",