This repository was archived by the owner on Apr 10, 2026. It is now read-only.
fix: board connection#105
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances board connection and flashing reliability in the Electron app by introducing a port operation lock mechanism, improved error handling during critical operations, and centralizing flow transmission logic. Additionally, it refactors MQTT configuration to use a unified URL format with validation schema.
Key changes:
- Added port operation locking to prevent race conditions during flashing and connection
- Enhanced flashing logic to handle port disconnection/reconnection gracefully
- Centralized flow transmission and connection state management with shared functions
- Refactored MQTT configuration from separate host/port/protocol fields to a unified URL format with Zod validation
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime/src/base.ts | Added debug logging to postMessage method |
| packages/mqtt-provider/src/stores/mqtt.ts | Replaced separate host/port/protocol fields with unified URL format including validation schema and parsing logic |
| packages/mqtt-provider/package.json | Added zod dependency for URL validation |
| yarn.lock | Updated dependencies to include zod |
| apps/figma-plugin/src/ui/pages/mqtt/index.tsx | Updated MQTT form to use URL field instead of separate host/port fields with tooltip documentation |
| apps/electron-app/src/render/hooks/useSignalNodesAndEdges.ts | Added commented debug log |
| apps/electron-app/src/render/hooks/useFlowSync.ts | Added connection status request on mount and flowChanged to dependency array |
| apps/electron-app/src/render/components/forms/MqttSettingsForm.tsx | Updated MQTT form to use URL field with validation |
| apps/electron-app/src/preload.ts | Added ipc-get-connection-status channel |
| apps/electron-app/src/main/port-manager.ts | Added port operation lock mechanism with acquire/release functions and startup board detection |
| apps/electron-app/src/main/ipc.ts | Added getCurrentConnectionState handler and refactored flow sending to use shared function |
| apps/electron-app/src/main/board-connection.ts | Major refactoring: added lock usage, enhanced error handling, added waitForPortToReappear function, improved cleanup logic |
| apps/electron-app/src/app.tsx | Cleaned up unused imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to the board connection and flashing logic in the Electron app, focusing on robustness, error handling, and preventing race conditions during critical operations. The main enhancements include the addition of a port operation lock mechanism, improved handling of board connection and flashing states, and refactoring of flow transmission to the runner process. These changes collectively make the connection process more reliable and easier to debug.
Board connection and flashing robustness:
port-manager.tsto prevent port polling during critical operations like flashing and connecting, with lock acquisition and release functions to avoid race conditions. [1] [2]board-connection.tsto use the port operation lock, ensuring that port polling does not interfere with these processes. Improved cleanup and error handling throughout the connection lifecycle. [1] [2]Flow transmission and connection state:
sendFlowToRunnerfunction and agetCurrentConnectionStatefunction to centralize flow transmission and connection status queries, improving code maintainability and reliability. [1] [2] [3]ipc.tsto use the new flow transmission and connection status functions, streamlining communication between the main and renderer processes. [1] [2]Minor cleanup and import adjustments:
app.tsxand related files for better code clarity. [1] [2]These changes should make board connection and flashing much more reliable, reduce intermittent errors, and simplify future maintenance and debugging.