fix(settings): remote admin always showed local node config#5560
Merged
Conversation
…ectedParam Koin 4.x's ViewModelStoreNavEntryDecorator provides its own empty SavedStateHandle via CreationExtras, which overrode the one passed through parametersOf(). This caused remote admin to always resolve destNum=null, making the ViewModel treat every session as local. Replace the SavedStateHandle indirection with a direct Int? parameter annotated with @InjectedParam so the destNum is passed reliably through Koin's dependency injection. Fixes remote admin showing local node config instead of the target node. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Remote admin was broken -- tapping "Remote Admin" on any node navigated to the Settings screen but always displayed the local node's configuration instead of the remote target.
Root Cause
Koin 4.x's Navigation 3
ViewModelStoreNavEntryDecoratorprovides its own emptySavedStateHandleviaCreationExtras, which silently overrode the one passed throughparametersOf(SavedStateHandle(mapOf("destNum" to destNum))). TheRadioConfigViewModelalways receiveddestNum = nullfromsavedStateHandle.get<Int>("destNum"), causing it to treat every session as local.Fix
Replace the
SavedStateHandleindirection with a direct@InjectedParam private val destNum: Int?constructor parameter. This passes the destination node number reliably through Koin's DI without relying onSavedStateHandlepopulation, which is incompatible with Nav 3's ViewModel scoping.Verification
RadioConfigVM: init destNum=1887308340andisLocal=falseafter the fix (previouslydestNum=null,isLocal=true):feature:settings:allTests,:feature:node:allTests)assembleFdroidDebugbuild succeeds