Skip to content

Conversation

@Jon-edge
Copy link
Collaborator

@Jon-edge Jon-edge commented Feb 4, 2026

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)

Note

Medium Risk
Changes token enable/disable persistence semantics and navigation interception; mistakes could cause lost changes or incorrect token states if pending/initial sets get out of sync.

Overview
Manage Tokens no longer persists token enable/disable changes immediately; toggles now update a local pending set and only call wallet.changeEnabledTokenIds when the user taps Save.

Adds an unsaved-changes guard on back navigation via a ButtonsModal (Save/Discard), disables the Save button when nothing changed, keeps the token list ordering stable during the session, and moves enable/disable activity logging to the save path (row toggle now just approves token terms and updates pending state).

Written by Cursor Bugbot for commit 209efc0. This will update automatically on new commits. Configure here.


- Use React.FC pattern for component definition
- Add explicit null check for strict boolean expression
- Add return type to keyExtractor
Capture initial enabled state on mount and use it for sorting to
prevent the token list from re-ordering when tokens are toggled.
Use React.FC pattern for component definition.
Remove live wallet updates and spinner animation. The row now
accepts an onToggle callback to update local state, deferring
the wallet update until explicit save. Token terms approval
still happens on toggle when enabling.
Replace live token toggling with local state that saves on explicit
button press. Changes include:

- Track pending changes locally until save
- Save button disabled when no changes, shows spinner while saving
- Prompt to save/discard when navigating back with unsaved changes
- Sync newly-added custom tokens into pending state
- Log token enable/disable activity on save
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 209efc02d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +74 to +78
// Capture initial enabled state for sorting (only on mount):
const initialEnabledTokenSet = React.useMemo(
() => new Set(enabledTokenIds),
[enabledTokenIds]
// eslint-disable-next-line react-hooks/exhaustive-deps
[]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update baseline when enabled tokens change externally

Because initialEnabledTokenSet is memoized with [], the “baseline” never updates if wallet.enabledTokenIds changes while this screen stays mounted (for example, returning from EditTokenScene, which calls wallet.changeEnabledTokenIds). The effect then copies the new token into pendingEnabledTokenIds, but hasUnsavedChanges still compares against the stale initial set, so the UI shows unsaved changes and a Save/Discard prompt even though the change already hit the wallet; discard can’t actually revert it. Consider updating the baseline on external changes or treating externally-added tokens as already saved.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems only valid for added tokens. We will preserve the state of any new tokens seen in the sync, but for anything already visible in the UI, we will take user changes at that point as the intended state of tokens.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

: [...wallet.enabledTokenIds, tokenId]
await wallet.changeEnabledTokenIds(newIds)
if (isEnabled) {
logActivity(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Token toggles even when terms modal dismissed

High Severity

When enabling a token, approveTokenTerms is called and onToggle is invoked in the .then() success handler. However, approveTokenTerms resolves successfully even when the user dismisses the ConfirmContinueModal without accepting (via the close button). The modal returns false on close, but approveTokenTerms doesn't check or propagate this value. This causes the token to be toggled on even when the user explicitly declined or dismissed the terms modal.

Fix in Cursor Fix in Web

)

const newIds = isEnabled
? wallet.enabledTokenIds.filter(id => id !== tokenId)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors from token terms silently swallowed

Medium Severity

The rejection handler for approveTokenTerms is () => {}, which silently swallows any errors. The previous implementation used usePendingPressAnimation which called showError(error) when the promise rejected. Now, if approveTokenTerms fails due to network issues, disk errors, or other problems, the user receives no feedback—the toggle simply appears unresponsive with no indication of what went wrong.

Fix in Cursor Fix in Web

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.

2 participants