fix(meshcore): preserve node name on empty advert + improve metadata text contrast#3771
fix(meshcore): preserve node name on empty advert + improve metadata text contrast#3771Yeraze wants to merge 2 commits into
Conversation
…3756) Zero-hop repeaters (and some MeshCore firmware builds) send `contact_advertised` events with `adv_name: ""`. The `??` operator passes an empty string through because `""` is not `null`/`undefined`, so the stored name was silently overwritten with an empty value on every re-advert. Change both the in-memory update (handleBridgeEvent) and the DB write (persistContact) to use `||` instead of `??` so empty strings fall back to the previously known value, the same way `null`/`undefined` already did. Adds a regression test that fires a named advert followed by an empty-name re-advert and asserts both the in-memory contact and the DB call retain the original name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UKnaQv47NKrW5Srxk88HHG
Scope and hop-route metadata lines (and the timestamp) were using --ctp-overlay0, which is too faint in Catppuccin light themes and still subtle in dark themes. Switch to --ctp-subtext0 for all three classes to give better contrast in both light and dark mode while keeping them visually secondary to the message body. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UKnaQv47NKrW5Srxk88HHG
|
Claude finished @Yeraze's task —— View job PR Review
Overall this is a clean, well-scoped PR. Both fixes are correct and the regression test is solid. A few observations below. Fix 1 —
|
|
Superseded. The #3769 metadata-contrast half of this PR already shipped in #3778 (time/route/scope set to |
Summary
Two small fixes for issues reported today:
Fix 1 — MeshCore node name lost after empty advert (#3756)
Root cause: Zero-hop repeaters (and some MeshCore firmware builds) send
contact_advertisedevents withadv_name: "". The??null-coalescing operator passes an empty string through unchanged (since""is notnull/undefined), so the stored node name was silently overwritten with an empty value on every re-advert.Fix: Change both the in-memory update (
handleBridgeEventline 1112) and the DB write (persistContactline 1473) to use||instead of??. This makes empty strings fall back to the previously known value, the same waynull/undefinedalready did.Test: Added a regression test in
meshcoreManager.contactPersistence.test.tsthat fires a named advert followed by an empty-name re-advert and asserts both the in-memory contact and the upsertNode DB call retain the original name.Fix 2 — MeshCore message metadata text readability (#3769)
Problem: The timestamp, hop-route, and scope metadata lines in MeshCore channel messages used
--ctp-overlay0, which is too faint in Catppuccin light themes and still quite subtle in dark themes.Fix: Switch all three CSS classes (
mc-message-time,mc-message-route,mc-message-scope) from--ctp-overlay0to--ctp-subtext0. This gives better contrast in both light and dark mode while keeping the metadata visually secondary to the message body.Files changed
src/server/meshcoreManager.ts??→ `src/server/meshcoreManager.contactPersistence.test.tssrc/components/MeshCore/MeshCorePage.css--ctp-overlay0→--ctp-subtext0for time/route/scope (3 lines)Test plan
vitest run src/server/meshcoreManager.contactPersistence.test.ts— new regression test should pass🤖 Generated with Claude Code
https://claude.ai/code/session_01UKnaQv47NKrW5Srxk88HHG
Generated by Claude Code