Edits to activity in send intent action are not saved - #2221
Merged
Conversation
ConfigIntentFragment applies its argument by calling ConfigIntentViewModel.loadResult from onCreate, which runs again when the screen is recreated (for example on a configuration change) while the ViewModel survives. Re-applying the original argument discarded any edits the user had made, such as changing the chosen activity, so the activity appeared to revert to its original value. Apply the initial argument only once so a recreation no longer overwrites the in-progress edits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLMhZgAZLKvtgPGKXC9oKq
sds100
approved these changes
Sep 7, 2026
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.
Closes #2160
Summary
When editing a send intent action and changing the chosen activity, the change could be silently discarded, leaving the original activity in place after saving.
ConfigIntentFragmentapplies its argument by callingConfigIntentViewModel.loadResultfromonCreate.onCreateruns again whenever the screen is recreated (for example on a configuration change such as rotation, entering multi-window, or a fold) while theViewModelsurvives. On that second run,loadResultre-applied the original argument and overwrote whatever the user had edited in the meantime — so a newly picked activity reverted to its original value.The fix makes
loadResultidempotent: the initial argument is applied only once, so a recreation no longer clobbers the in-progress edits held by the survivingViewModel.Changes
ConfigIntentViewModel.loadResultnow applies the initialConfigIntentResultargument only the first time it is called (guarded by anisResultLoadedflag).ConfigIntentViewModelRecreationTest, a regression test that loads an intent, changes the activity, simulates a recreation (a secondloadResultwith the original argument), and asserts the edited activity is preserved in both the view-model state and the produced intent URI.CHANGELOG.mdentry under Fixed.How it was verified
The regression test fails against the previous behaviour (activity resets to the original) and passes with the fix. Existing
ConfigIntentViewModelTestcases andktlintcontinue to pass.Notes / areas for human review
ViewModel, which survives configuration changes but not full process death. On process death theViewModelis recreated from scratch,isResultLoadedresets tofalse, and the original argument is reloaded — the same behaviour as before this change (in-progress, unsaved edits are not persisted across process death; that would require aSavedStateHandleand is out of scope here).loadResulthas a single caller (ConfigIntentFragment.onCreate), so making it load-once does not affect any other flow.🤖 Generated with Claude Code
https://claude.ai/code/session_01FLMhZgAZLKvtgPGKXC9oKq
Generated by Claude Code