Repository navigation
refactor(renderer): route native calls through a platform service - #2546
Conversation
The main process never sends selectKulerColor or updateKulerColor, so these handlers could never run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Components and services called window.electronAPI directly, each with its own guard and its own channel strings. The new platform service owns the bridge, types every command and event, and returns an unsubscribe function from on(). Swapping Electron for Tauri now changes one file in the renderer. The settings menu reads the OS from the preload value instead of the getPlatform IPC call, so that handler is gone from the main process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Why
We plan to move Swach from Electron to Tauri. The renderer called
window.electronAPIdirectly in 10 files, each with its own guard and channel strings. This PR puts every native call behind one typed service, so the Tauri swap changes one renderer file.What changed
app/services/platform.tsowns the bridge. It types every command and event, andon()returns an unsubscribe function in place ofremoveAllListeners.isNativeAppandnativeOsexports.getPlatformIPC handler, and commented-out tests.Scope
getPlatformhandler.Blast Radius
This touches every renderer path that talks to the main process: picker, clipboard, undo/redo, theme, auto-start, dock icon, import/export, updates, shared palettes. The packaged Electron test run covers the settings and data paths. The picker and tray paths have no automated tests.
Verification
pnpm test:electron: 71/71 pass, the same 71 test names as onmain.pnpm test:ember: 72/72 pass.eslintandpnpm lint:typesare clean.🤖 Generated with Claude Code
Summary by CodeRabbit