dsh-unlag 1.9.8 → 1.9.10

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 +10 -0
  2. package/index.js +12 -1
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -581,6 +581,7 @@ window.__ModuleLoader__.load({
581
581
  return () => clearTimeout(timer);
582
582
  }, [notice]);
583
583
 
584
+
584
585
  const style = pending
585
586
  ? { ...BUTTON_STYLE, opacity: 0.4 }
586
587
  : hover
@@ -658,6 +659,15 @@ window.__ModuleLoader__.load({
658
659
  pressInFlight = false;
659
660
  // The document goes away on a rebuild, so the button only needs re-enabling when it does not.
660
661
  if (!navigated) setPending(false);
662
+ else {
663
+ setTimeout(() => {
664
+ // Still here after asking for a rebuild: the page held the navigation. Say what
665
+ // happened and take the press back, so the button is never left unresponsive.
666
+ report('held', 'navigation');
667
+ setPending(false);
668
+ setNotice(noticeFor('replaced'));
669
+ }, 6000); // ui-copy-ignore
670
+ }
661
671
  }
662
672
  };
663
673
 
package/index.js CHANGED
@@ -36,6 +36,16 @@ const RELOAD_TIMEOUT_MS = 20_000
36
36
  const LOG_PATH = join(homedir(), '.dsh', 'unlag-reload.log')
37
37
  /** Past this many bytes the log starts over: it records recent presses, not an archive. */
38
38
  const LOG_MAX_BYTES = 1_000_000 // ui-copy-ignore
39
+
40
+ /** Which version this half is running: the only way to tell a reloaded half from a stale one. */
41
+ const VERSION = (() => {
42
+ try {
43
+ const raw = readFileSync(new URL('./package.json', import.meta.url), 'utf8') // ui-copy-ignore
44
+ return String(JSON.parse(raw)?.version ?? 'unknown')
45
+ } catch {
46
+ return 'unknown'
47
+ }
48
+ })()
39
49
  let logWrites = 0
40
50
  /** Tests point this at a scratch file, so a test run leaves the live log readable. */
41
51
  const logTarget = () => process.env.DSH_UNLAG_LOG ?? LOG_PATH
@@ -1415,7 +1425,7 @@ function serveButton(ctx, controller, config) {
1415
1425
  [
1416
1426
  `${BASE_PATH}/state`,
1417
1427
  (_req, res) => {
1418
- sendJson(res, 200, { plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1428
+ sendJson(res, 200, { version: VERSION, plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1419
1429
  },
1420
1430
  ],
1421
1431
  [
@@ -1548,6 +1558,7 @@ export function apply(ctx, config) {
1548
1558
  }
1549
1559
  // Printed on every start so a reader of the log knows which action applies a change: a person
1550
1560
  // pressing the button, never this plugin, and never a restart of the app.
1561
+ log(`dsh-unlag ${VERSION} loaded`)
1551
1562
  log('plugin reload is manual: ask the user to press the refresh button; do not restart the app')
1552
1563
  if (settingsOf(config ?? {}).autoReload === true) {
1553
1564
  syncWatching()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.8",
3
+ "version": "1.9.10",
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",