Skip to content

fix: loadCachedDb() before backfill to ensure in-mem nodedb isn't stale, show filtered count in nodelist#3827

Merged
jamesarich merged 8 commits into
meshtastic:mainfrom
mdecourcy:fix/preserve-node-data-on-reconnection
Nov 27, 2025
Merged

fix: loadCachedDb() before backfill to ensure in-mem nodedb isn't stale, show filtered count in nodelist#3827
jamesarich merged 8 commits into
meshtastic:mainfrom
mdecourcy:fix/preserve-node-data-on-reconnection

Conversation

@mdecourcy

Copy link
Copy Markdown
Contributor

Summary

Fixes multiple issues where node data (names, positions, etc.) was being lost during device reconnection.

Changes

1. Fixed installConfig overwriting node names

Problem: installConfig was being called with nodeDBbyNodeNum.values which only contained ~80 nodes from firmware backfill. This caused it to overwrite existing node data in the database, clearing names of nodes that weren't in the backfill.

Solution: Call installConfig with an empty node list, so it only updates myNodeInfo without touching node data. Individual nodes are already properly upserted via updateNodeInfo->nodeRepository.upsert.

2. Fixed missing nodes after device switch

Problem: When switching devices, discardNodeDB() cleared the in-memory cache but nodes weren't reloaded from the newly switched database.

Solution: Call loadSettings() (now loadCachedDb()) after database switch to reload all nodes into memory before backfill runs.

3. Added filtered node count display

Problem: Users couldn't easily tell if filters were hiding nodes vs nodes actually being lost.

Solution: Updated node list subtitle from (X online / Y total) to (X online / Y shown / Z total) to clearly show how many nodes are filtered vs total.

…ction

installConfig was being called with nodeDBbyNodeNum.values which only
contained the ~80 nodes from firmware backfill. This caused it to
overwrite existing node data in the database, clearing names of nodes
that weren't in the backfill.

Now installConfig is called with an empty node list, so it only updates
myNodeInfo without touching node data. Individual nodes are already
properly upserted via updateNodeInfo->nodeRepository.upsert.
@github-actions github-actions Bot added the bugfix PR tag label Nov 26, 2025
@jamesarich jamesarich added this to the 2.7.8 milestone Nov 26, 2025
@mdecourcy mdecourcy marked this pull request as ready for review November 26, 2025 19:10
@jamesarich jamesarich enabled auto-merge November 26, 2025 19:36
@jamesarich jamesarich added this pull request to the merge queue Nov 26, 2025
Merged via the queue into meshtastic:main with commit 500ae49 Nov 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants