-
Notifications
You must be signed in to change notification settings - Fork 212
refactor: device connection logic, added nonce to get config only #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
refactor: device connection logic, added nonce to get config only #946
Conversation
|
@danditomaso is attempting to deploy a commit to the Meshtastic Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new MeshService class to centralize connection management and configuration flow for mesh devices. The service manages the lifecycle of device connections, batches node information during initial configuration for performance, and implements a two-stage configuration flow with heartbeat management.
Key changes:
- New
MeshServiceclass for managing mesh device connections and configuration - Refactored node handling to batch-process nodes during initial configuration and process individually afterward
- Added
pruneStaleNodesfunctionality to nodeDB store with 14-day retention policy - Updated connection status handling and event subscriptions
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/web/src/core/services/MeshService.ts | New service class for connection lifecycle management, configuration flow, and heartbeat handling |
| packages/web/src/pages/Connections/useConnections.ts | Integrated MeshService for connection management, updated setupMeshDevice to handle batched nodes |
| packages/web/src/core/subscriptions.ts | Removed individual node handling logic, now delegated to MeshService |
| packages/web/src/core/stores/nodeDBStore/index.ts | Added pruneStaleNodes method with 14-day retention, removed old eviction logic |
| packages/web/src/core/stores/nodeDBStore/nodeDBStore.mock.ts | Updated mock to include new pruneStaleNodes method |
| packages/core/src/utils/transform/decodePacket.ts | Updated config complete handling to emit event for MeshService |
| packages/core/src/utils/eventSystem.ts | Added onConfigComplete event dispatcher |
| packages/web/src/components/DeviceInfoPanel.tsx | Extended status color mapping for new connection states |
| packages/web/src/components/Dialog/AddConnectionDialog/AddConnectionDialog.tsx | Type improvement: using ConnectionType instead of string literal union |
| packages/web/src/components/PageComponents/Map/Markers/NodeMarker.tsx | Removed unused label parameter |
| packages/web/src/pages/Connections/index.tsx | Removed extra blank line |
| .gitignore | Added .DS_Store exclusion |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Description
This pull request introduces a new
MeshServiceclass to centralize mesh device connection, configuration, and node management logic, replacing scattered event handling and improving the flow for configuration and node updates. It also updates the node database retention strategy to prune stale nodes by age rather than a fixed count, and refactors event handling and status mapping throughout the codebase for consistency and maintainability.MeshService introduction and connection flow improvements:
MeshServiceclass (packages/web/src/core/services/MeshService.ts) to manage device connection lifecycle, configuration state, heartbeat, and node batching, providing a unified event-driven API for mesh device interactions.MeshServiceand its events. [1] [2]Node database retention and pruning:
nodeDBStoreto prune nodes not heard from in the last 14 days, replacing the previous fixed-count eviction strategy. Added a newpruneStaleNodesmethod and integrated pruning into nodeDB initialization and access. [1] [2] [3]pruneStaleNodesmethod. [1] [2]Event and status handling enhancements:
onConfigCompleteevent to the core event system (eventSystem.ts) and updated packet decoding to dispatch this event, enabling the two-stage configuration flow managed byMeshService. [1] [2]Checklist
CONTRIBUTING_I18N_DEVELOPER_GUIDE.md for more details)