-
Notifications
You must be signed in to change notification settings - Fork 279
Sam/optimize initialize account #5858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5956aee to
5d92708
Compare
5d92708 to
e6e97a1
Compare
swansontec
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found two small glitches, and one question.
b2cec9d to
c00ed98
Compare
The showScamWarningModal function was already disabled (always returns false), making these calls unnecessary async overhead during login and other operations. Removes calls from: - initializeAccount (firstLogin) - WcConnectionsScene (firstWalletConnect) - WalletListMenuActions (firstPrivateKeyView)
When Settings.json doesn't exist (new account or first login), return default values without writing them to disk. Defaults are derived from cleaners, so they don't need to be persisted. Settings will be written when the user explicitly changes a value. This eliminates unnecessary disk I/O during the login flow.
When local Settings.json doesn't exist (new account), return default values without writing them to disk. Defaults are derived from cleaners, so they don't need to be persisted. Settings will be written when values actually change. This eliminates unnecessary disk I/O during the login flow.
Move biometric checks (isTouchEnabled, getSupportedBiometryType) from blocking awaits to background Promise execution. This removes two blocking native module calls from the critical login path. The biometric state is loaded asynchronously and dispatched via a new UI/SETTINGS/SET_TOUCH_ID_SUPPORT action when available. The UI will use default values (false) until the background check completes. Also removes the redundant refreshTouchId call - this is already called by edge-login-ui-rn in submitLogin() before the onLogin callback, so the call here was unnecessary.
c00ed98 to
608a2b5
Compare
608a2b5 to
6f9ada5
Compare
|
|
||
| for (const pluginId of Object.keys(denominationSettings)) { | ||
| const currencyConfig = account.currencyConfig[pluginId] | ||
| if (currencyConfig == null) continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migration loses settings for temporarily unavailable plugins
The migrateDenominationSettings function skips any plugin where account.currencyConfig[pluginId] is null (line 580), but then writes cleanedSettings which only contains the processed plugins (line 630). If a user has custom denomination settings for a plugin that happens to be temporarily unavailable during the one-time migration (e.g., due to a plugin update, network issue, or disabled plugin), those settings are permanently lost because they're not preserved in cleanedSettings. The settings for unavailable plugins need to be copied to cleanedSettings before they're skipped.
Additional Locations (1)
Remove isTouchEnabled and isTouchSupported from global Redux state. Biometric state is now loaded lazily in SettingsScene using useAsyncValue, which removes it from the login critical path. - Remove biometric fields from SettingsState and AccountInitPayload - Remove CHANGE_TOUCH_ID_SETTINGS action type - Remove updateTouchIdEnabled thunk from SettingsActions - SettingsScene loads biometric state locally on mount via useAsyncValue - Toggle calls enableTouchId/disableTouchId directly with local state
Add a migration that removes default denomination values from the synced settings file. This migration: 1. Runs once per account (tracked via denominationSettingsOptimized flag) 2. Compares each saved denomination to the default from currencyInfo 3. Removes entries that match the default (they're derived on-demand) 4. Reduces settings file size for existing accounts The migration runs in the background after ACCOUNT_INIT_COMPLETE to avoid blocking the login flow. For existing accounts with many saved denominations, this significantly reduces the settings file size.
Remove the expensive nested loop that merged default denomination settings with synced settings. Since default denominations are no longer populated in the LOGIN reducer, we can use synced settings directly. The synced settings contain only user customizations. Default denominations are derived on-demand from currencyInfo via selectors.
Remove the expensive loop that populated denomination defaults for all currency plugins and tokens during LOGIN. This loop iterated through every plugin and token to set default denominations in Redux state. Denomination defaults are already available from currencyInfo and can be derived on-demand via selectors (selectDisplayDenom already has fallback logic to currencyConfig). This change eliminates unnecessary work during the login critical path.
Separate out the new account workflow to `navigateToNewAccountFlow` in initializeAccount and the existing account flow into `navigateToExistingAccountHome`.
Eliminate the ACCOUNT_INIT_COMPLETE action by loading all settings upfront and dispatching them in the LOGIN action. This enables immediate navigation after login since all required state is available in Redux right away. - Load synced and local settings in parallel before LOGIN dispatch - Expand LOGIN action payload to include syncedSettings and localSettings - Remove ACCOUNT_INIT_COMPLETE action type and AccountInitPayload - Remove pinLoginEnabled from Redux, load locally in SettingsScene - Remove togglePinLoginEnabled thunk from SettingsActions - Update WalletsReducer to remove ACCOUNT_INIT_COMPLETE handling - Update SpendingLimitsReducer to read from LOGIN payload - Update PasswordReminderReducer to read from LOGIN payload - Remove getFirstActiveWalletInfo (walletId/currencyCode no longer set at login)
6f9ada5 to
ef36815
Compare
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have:
Note
Improves login startup and simplifies settings/state handling.
syncedSettingsandlocalSettingsin parallel, then dispatch a singleLOGINwith both; removeACCOUNT_INIT_COMPLETEusage across reducersmigrateDenominationSettingsto strip default denoms and setdenominationSettingsOptimizedflagLOGINpayload: settings scene state,SpendingLimitsReducer, andPasswordReminderReducer; adjust tests/snapshots accordinglySettingsScene: manage biometrics and PIN locally (viaedge-login-ui-rn+ react-query), remove Redux touch/pin toggles; improve error handlingLoginActions: restructure navigation (new/existing account), keep notification/survey flows; stop writing defaults when settings files are missingFakeProvidersWritten by Cursor Bugbot for commit ef36815. This will update automatically on new commits. Configure here.