Release vv1.5.3
Overview
Critical bug fix release that finally resolves the Ctrl+I sidebar toggle functionality. The v1.5.1 fix did not work due to contextBridge callback serialization issues. This release implements a proper CustomEvent-based architecture that correctly handles IPC communication across Electron's isolated contexts.
Bug Fix
Sidebar Toggle (Ctrl+I) - Properly Fixed
- Issue: Ctrl+I global shortcut has been broken since v1.5.0 (when diagnostics panel was added)
- v1.5.1 Fix Attempt: Did not work - relied on passing callback functions across Electron's contextBridge
- Root Cause: Callbacks fail silently due to serialization issues between isolated contexts
- Additional Issue: IPC listener was set up inside a function (delayed) rather than immediately
Technical Solution: CustomEvent Architecture
The proper fix uses a CustomEvent-based architecture instead of callback serialization:
Main Process (Ctrl+I detected)
|
v
IPC "sidebar-toggle" message
|
v
Preload (immediate listener, runs on load)
|
v
CustomEvent dispatched to window
|
v
Overlay listens for CustomEvent directly on window
|
v
Sidebar toggles successfully
Root Cause Analysis
| Version | Issue |
|---|---|
| v1.5.0 | Global shortcut registration was commented out, breaking Ctrl+I |
| v1.5.1 | Re-enabled shortcut but used callback-based IPC pattern that fails silently |
| v1.5.3 | Implemented proper CustomEvent pattern with immediate listeners |
Why v1.5.1 Failed
- The
onSidebarToggle(callback)approach passes a function through contextBridge - Electron's contextBridge cannot serialize functions between isolated contexts
- The callback becomes undefined or throws silently, causing no sidebar toggle
- The listener was also set up lazily inside a function instead of immediately on preload
Why v1.5.3 Works
- Preload script sets up IPC listener immediately on load (not inside a function)
- Uses
window.dispatchEvent(new CustomEvent('sidebar-toggle'))for communication - Overlay component adds event listener directly on window object
- No function serialization required - only string events cross the context boundary
Files Modified
src/electron/main.ts- Added debug logging for shortcut registration verificationsrc/electron/preload.ts- IPC listener runs immediately, dispatches CustomEvent to windowsrc/overlay/index.tsx- Listens for CustomEvent directly on window instead of IPC callback
Technical Notes
This fix demonstrates an important pattern for Electron IPC communication:
- Never pass callbacks through contextBridge for IPC events
- Use CustomEvents for renderer-to-renderer communication triggered by main process
- Immediate listeners in preload ensure events are never missed
- Debug logging in main process helps verify shortcut registration
Testing
All quality checks pass:
- Prettier: All files formatted correctly
- ESLint: No errors
- TypeScript: No type errors
- Build: Successful
- Tests: 8 passing tests
Generated with Claude Code