[object Object]

← back to Dot Palette

dot-palette: guard IPC calls so the palette degrades gracefully without the preload bridge (TK-11877)

9fc1f03f2412af48a83f087e75e3c4ac21c71b06 · 2026-09-17 07:34:23 -0700 · Steve Abrams

Empirically seeded by cycle-1 screenrecord: opening index.html in a plain browser
(no Electron preload) threw uncaught 'Cannot read properties of undefined (reading
move/quit)' on grip-drag + close. window.palette?.move?.() / ?.quit?.() no-op when
the bridge is absent; identical in Electron where preload defines window.palette.
Isolated screenrecord re-test: 10 error-bearing records -> 0 (5 passes clean).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wvstRQCpemptApArrjQRg

Files touched

Diff

commit 9fc1f03f2412af48a83f087e75e3c4ac21c71b06
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Sep 17 07:34:23 2026 -0700

    dot-palette: guard IPC calls so the palette degrades gracefully without the preload bridge (TK-11877)
    
    Empirically seeded by cycle-1 screenrecord: opening index.html in a plain browser
    (no Electron preload) threw uncaught 'Cannot read properties of undefined (reading
    move/quit)' on grip-drag + close. window.palette?.move?.() / ?.quit?.() no-op when
    the bridge is absent; identical in Electron where preload defines window.palette.
    Isolated screenrecord re-test: 10 error-bearing records -> 0 (5 passes clean).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_017wvstRQCpemptApArrjQRg
---
 public/index.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/public/index.html b/public/index.html
index 8d3914b..b67a199 100644
--- a/public/index.html
+++ b/public/index.html
@@ -81,11 +81,11 @@
       if (!dragging) return;
       const dx = e.screenX - lastX, dy = e.screenY - lastY;
       lastX = e.screenX; lastY = e.screenY;
-      if (dx || dy) window.palette.move(dx, dy);
+      if (dx || dy) window.palette?.move?.(dx, dy);   // no-op if the IPC bridge is absent (e.g. opened in a plain browser)
     });
     grip.addEventListener('pointerup', (e) => { dragging = false; try { grip.releasePointerCapture(e.pointerId); } catch {} });
 
-    document.getElementById('x').addEventListener('click', () => window.palette.quit());
+    document.getElementById('x').addEventListener('click', () => window.palette?.quit?.());  // guarded: harmless if no IPC bridge
   </script>
 </body>
 </html>

← bc3244f dot-palette: side-effect-free test seam + selftest + safe-by  ·  back to Dot Palette  ·  (newest)