Skip to content

Fix Use Biometrics toggle reverting after leaving Settings#6062

Open
j0ntz wants to merge 1 commit into
developfrom
jon/fix-biometric-toggle
Open

Fix Use Biometrics toggle reverting after leaving Settings#6062
j0ntz wants to merge 1 commit into
developfrom
jon/fix-biometric-toggle

Conversation

@j0ntz

@j0ntz j0ntz commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Description

Asana: https://app.asana.com/0/1215088146871429/1213428787796786

Fixes the Settings "Use Biometrics" toggle reverting to its previous state after the user leaves and re-enters the Settings scene.

Root cause: commit acc2adbc moved biometric state out of Redux into a @tanstack/react-query query (['biometricState', account.id]) plus a local touchIdEnabled state that syncs from the query only once per mount. handleUpdateTouchId persisted the change via enableTouchId/disableTouchId but never updated the query cache, and the app-level cache has no staleTime and does not refetch on focus. On re-entering Settings the scene remounts, the one-time sync reads the stale cached value, and the toggle shows the old state. Reported on Android; also reproduces on iOS, since the cause is platform-agnostic.

Fix: after the enable/disable persists, update the cached biometric state with queryClient.setQueryData so the cache reflects the value the user set. The next mount's sync then reads the correct value.

Testing: added a regression test (SettingsScene.biometric.test.tsx) that mounts the scene, toggles biometrics off, and asserts the shared query cache flips to the persisted value across a remount. It fails on the pre-fix code (cache stays true) and passes with the fix. Full tsc, eslint, and the jest suite pass. The toggle could not be exercised on the simulator because biometric enrollment is unavailable headlessly (no simctl biometry command; the Simulator Face ID enrollment menu requires GUI automation that is not reachable in this environment), so the deterministic test is the verification of the changed code path.


Note

Low Risk
Small Settings-only change that updates query cache after existing keychain persistence; regression test covers the path.

Overview
Fixes Use Biometrics in Settings appearing to revert after you leave and come back.

Biometric on/off was still saved via enableTouchId / disableTouchId, but the ['biometricState', account.id] React Query cache was never updated. On remount, the scene syncs local toggle state from that cache once, so it could show the old value. After a successful persist, handleUpdateTouchId now calls queryClient.setQueryData with the new isTouchEnabled.

Adds SettingsScene.biometric.test.tsx to assert the shared cache stays correct across unmount/remount, and a CHANGELOG entry under 4.49.0.

Reviewed by Cursor Bugbot for commit 2bc3a1c. Bugbot is set up for automated code reviews on this repo. Configure here.

The Settings biometric (Use Biometrics) toggle read its state from a
cached react-query result that was never updated when the user toggled
it. After leaving and re-entering Settings the scene remounted and the
one-time local-state sync read the stale cached value, showing the
wrong toggle state. Update the cached biometric state after persisting
the change so re-entry reflects the value the user set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant