Repository navigation
Settings › Voice: switches update as soon as they're tapped - #27
Merged
Merged
Conversation
With a server that brokers calls through OpenCode Console (Server Voice), tapping Enable Voice or Raise to Talk set the shared value but the switch didn't move until the page was opened again. VoiceSettingsFeature.State reads its shared values through getters, so tapping a switch leaves the store's state equal and the same instance. The page recomposed on the shared-value revision, but its LazyColumn rows capture only `state` and `keySource`; with the OpenCode key source (a data object) nothing they captured changed, so Compose skipped them and the switch stayed put. With a phone key the row happened to refresh because keySource was a new Phone(...) each time. rememberVoiceState() now hands the Voice pages a fresh copy of the state whenever the state or a shared value changes, so rows reading shared values through it recompose. Used by Settings › Voice, Call Voice picker, Voice Provider (detail and account) and the Delegator page, which shared the pattern. iOS reads @shared values through observable state, so it never had this bug. Verified: scripts/check.sh :feature:settings (vm.sh check) passes. On the emulator against session-lab patched to list its voice models as provider "opencode" (Server Voice on): reproduced on v0.3.10 and on main b1c62c0 (Enable Voice and Raise to Talk stay put until re-entering); with this change Enable Voice on/off, three quick taps and Raise to Talk on/off all update at once.
This branch was previously deployed
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.
Bug
Users whose server runs voice calls through its OpenCode Console workspace (footer: "Calls are billed to your server's OpenCode Console workspace.") tap Enable Voice or Raise to Talk in Settings › Voice and the switch looks stuck. The setting does change; the switch only catches up after leaving the page and coming back. Reported on v0.3.10; still on main after #5, which makes this the default path for everyone. Users with their own phone key weren't affected.
Cause
VoiceSettingsFeature.Statereads these settings through getters, so a tap leaves the state object unchanged. The page's list rows capture onlystateand the key source (a singleton for OpenCode), so Compose skipped them and the switch never redrew.Fix
rememberVoiceState()gives the Voice pages a fresh copy of the state whenever the state or a shared setting changes, so rows reading settings through it redraw. Used by Settings › Voice, the call voice picker, Voice Provider (detail and account) and the Delegator page, which all had the same pattern. iOS reads these through observable state and never had the bug.Verified
scripts/check.sh :feature:settingspasses.opencode, default settings (no Experimental switch): reproduced on v0.3.10 and on maind174905b. With this branch, Enable Voice on/off, three quick taps, and Raise to Talk on/off all update at once.