fix: preserve channel names when device sends empty names#1703
Conversation
When a Meshtastic device reconnects, it often sends channel configuration with empty name fields (especially for the default Primary channel). This was overwriting existing non-empty channel names in the database, causing Android/iOS virtual node clients to display "Channel Name" placeholder text. Fix: When updating a channel, if the incoming name is empty but an existing non-empty name exists in the database, preserve the existing name instead of overwriting it with empty. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job Analyzing this pull request and will provide code review feedback Review Checklist
Code Review SummaryThis is a well-implemented fix for issue #1567. The solution elegantly addresses the problem of device reconnections overwriting existing channel names with empty strings. ✅ StrengthsClean Implementation
Correct Logic
🔍 Technical AssessmentPerformance: ✅ No concerns
Security: ✅ No concerns
Database Compatibility: ✅ Excellent
🧪 Test Coverage AssessmentExisting Coverage: The current tests in Recommended Test Addition (optional but valuable): it('should preserve existing channel name when incoming name is empty', () => {
// Create channel with name
db.upsertChannel({ id: 1, name: 'MyChannel', psk: 'secret123' });
// Simulate device reconnection with empty name
db.upsertChannel({ id: 1, name: '', psk: 'secret123' });
const channel = db.getChannelById(1);
expect(channel.name).toBe('MyChannel'); // Should preserve original name
});🎯 Edge Case AnalysisHandled Correctly:
No Issues Found: The logic handles all reasonable edge cases appropriately. 📋 Manual Testing RecommendationsSince this affects device reconnection behavior, the manual test plan in the PR description is appropriate:
Final AssessmentThis is a high-quality fix that directly addresses the reported issue with minimal risk. The implementation follows repository conventions, maintains database compatibility, and includes helpful logging for troubleshooting. Recommendation: ✅ Approve - Ready to merge The only minor enhancement would be adding the suggested test case, but the existing manual testing plan provides adequate coverage for this specific bug fix. |
|
I really appreciate your efforts on this issue. I hate to be the bearer of bad news, but it is still happening on 3.4.2. I realize there are two aspects of this: a.) how Meshmonitor handles the aftermath of the drop/reconnect, and b.) what is causing the drop in the first place. Based on the Info tab of Meshmonitor, I have noticed the virtual node connection seems to be reset every 3 hours. I.e. it said connected at 3:03, channel names worked fine until now, and when I looked at the tab, it says connected at 6:03 and vn- has indeed been incremented. If other node hardware is doing 100% uptime, then I am wondering if there may be instability in the esp32 firmware my Heltec V4 is running which is causing it to momentarily drop every 3 hours. I don't have any other node hardware to test with. I left ping running for a while, and out of ~3000 packets to the node, 3 were lost, which is suspicious. I googled "esp32 dropping every 3 hours" and found others experiencing various WiFi drops with other esp32-based hardware (home automation, etc). I'm going to try a static IP and see if that helps any. Thank you again for your work, Meshmonitor is great! |
… (Yeraze#1703) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

Summary
Problem
When a Meshtastic device reconnects, it often sends channel configuration with empty name fields (especially for the default Primary channel). The
upsertChannelfunction was unconditionally overwriting the database channel name with the incoming value, even when empty. This caused:Solution
When updating a channel, check if the incoming name is empty. If so, preserve the existing non-empty name from the database instead of overwriting it.
Test plan
Fixes #1567
🤖 Generated with Claude Code