fix(#120): remove duplicate ipcMain.on listener for visualizer-settings:update#139
fix(#120): remove duplicate ipcMain.on listener for visualizer-settings:update#139anshul23102 wants to merge 1 commit into
Conversation
…alizer-settings:update
Two listeners were registered on the same visualizer-settings:update channel:
ipcMain.on('visualizer-settings:update', ...) // fire-and-forget, no error handling
ipcMain.handle('visualizer-settings:update', ...) // request-response, returns updated state
On every settings update from the renderer both handlers fired, calling
updateSettings(patch) twice and applying the patch to disk twice per message.
Errors thrown inside the ipcMain.on callback were silently swallowed because
fire-and-forget listeners have no error propagation path back to the renderer.
Removed the ipcMain.on registration. The ipcMain.handle registration is the
correct pattern for this channel: it applies the patch once, persists it, and
returns the updated settings object to the renderer as the invoke reply.
Fixes SamXop123#120
|
@anshul23102 is attempting to deploy a commit to the Dot_NotSam's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
More reviews will be available in 59 minutes and 2 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
main.jsregistered two competing listeners on thevisualizer-settings:updateIPC channel simultaneously: anipcMain.on(fire-and-forget) and anipcMain.handle(request-response). On every settings update from the renderer both handlers fired, callingupdateSettings(patch)twice per message and writing the patch to disk twice. Errors thrown inside theipcMain.oncallback were silently discarded with no propagation back to the renderer, making the channel unreliable.Closes #120
Root Cause
Both execute on every
ipcRenderer.invoke('visualizer-settings:update', patch)call.Fix
Removed the
ipcMain.onregistration. TheipcMain.handleregistration is the correct pattern for this channel: it applies the patch once, persists it, and returns the updated settings object to the renderer as the invoke reply.Files Changed
main.js: Removed the 4-lineipcMain.on('visualizer-settings:update', ...)block.How to Test
Checklist
ipcMain.handleregistration provides full update semantics.