fix(auto-favorite): scope status fetch to active source (#2826)#2828
Merged
fix(auto-favorite): scope status fetch to active source (#2826)#2828
Conversation
The Auto Favorite UI fetched `/api/auto-favorite/status` without the active sourceId, so the backend fell through to the legacy singleton manager — which is whichever source was registered first. Users with multiple sources saw the role/firmware/managed-nodes status of the *first* source even after switching away from it, producing false "Your node role is X — Auto Favorite requires …" warnings on correctly-configured sources. - Append `sourceQuery` to the status fetch URL so the backend resolves the manager via `sourceManagerRegistry.getManager(sourceId)`. - Add `sourceQuery` to the `fetchData` useCallback deps so switching sources actually re-fetches. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job PR Review Complete ✅Reviewing pull request #2828: fix(auto-favorite): scope status fetch to active source Todo List:
Code Review Findings✅ Code Quality & Best Practices
✅ Bug Fix Analysis
✅ Performance Considerations
✅ Security Assessment
✅ Test CoverageExcellent test additions:
RecommendationsApproval Recommended ✅This is a high-quality fix that:
Optional Enhancements (Not blocking)
SummaryThis PR effectively fixes issue #2826 with a clean, well-tested solution. The implementation correctly ensures auto-favorite status fetching respects the active source selection, preventing the confusing role warnings experienced by multi-source users. The regression tests will prevent this issue from reoccurring. Recommended action: ✅ Approve and merge |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #2826 — Auto Favorite always read status (role/firmware/managed nodes) from the first registered source, even after switching to a different one. Multi-source users with one Client Base + one Client Mute saw the false warning "Your node role is 'Client Mute' — Auto Favorite requires Router, Router Late, or Client Base" on the perfectly-configured Client Base source.
Root cause
AutoFavoriteSection.tsxfetched/api/auto-favorite/statuswithout thesourceQueryfragment. The backend route atserver.ts:1345falls back to the legacymeshtasticManagersingleton when no?sourceId=is supplied — and that singleton is whichever source was registered first at startup. The settings fetch in the same component already passedsourceQuerycorrectly; the status fetch was an oversight.Fix
sourceQueryto the/api/auto-favorite/statusURL.sourceQueryto thefetchDatauseCallbackdeps so switching sources actually re-fetches.Test plan
AutoFavoriteSection.test.tsxassert the URL carries the active sourceId, and that the no-source legacy path still works.npx vitest run src/components/AutoFavoriteSection.test.tsx— 6/6 pass.🤖 Generated with Claude Code