Skip to content

fix: show loading indicator instead of no-wallet during wallet deletion#10555

Closed
PatrickChoo wants to merge 5 commits intoOneKeyHQ:xfrom
PatrickChoo:fix/hide-account-selector-no-wallet
Closed

fix: show loading indicator instead of no-wallet during wallet deletion#10555
PatrickChoo wants to merge 5 commits intoOneKeyHQ:xfrom
PatrickChoo:fix/hide-account-selector-no-wallet

Conversation

@PatrickChoo
Copy link
Copy Markdown
Collaborator

@PatrickChoo PatrickChoo commented Mar 9, 2026

Summary

  • When deleting a wallet (with other wallets still present), the UI briefly flashed the "No Wallet" empty state. Now shows a loading spinner during the async wallet switch transition using accountSelectorSyncLoadingAtom.
  • Hide account selector and header components gracefully during wallet removal by checking sync loading state across HomePageView, AccountSelectorTriggerHome, SelectorTrigger, WalletConnectionGroup, MDHeader, and InPageHeader.
  • Extract accountUtils.hasNoUsableWallet() to replace duplicated no-wallet detection logic, replacing the coarse if (wallet) check with a precise !wallet || (isOthersWallet && !account) condition.
  • Extract useIsAccountSelectorSyncLoading(num) hook to centralize sync loading reads.
  • Extract NoWalletContent component to isolate sync loading subscription from the HomePageView page memo.
Screenshot 2026-03-09 at 22 00 46

Jira

  • OK-51091
  • OK-51094

Test plan

  • Create multiple wallets, delete one wallet — verify no "No Wallet" flash, spinner shown briefly instead
  • Delete the last wallet — verify "No Wallet" empty state still shows correctly
  • Web dapp mode with no wallet — verify Connect button still shows
  • Verify Android/iOS Home header Row 2 hides when no usable wallet
  • URL account scenario (Discovery tab) — verify SelectorTrigger behaves correctly

@revan-zhang
Copy link
Copy Markdown
Contributor

revan-zhang commented Mar 9, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Minnzen
Minnzen previously approved these changes Mar 9, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread packages/kit/src/components/TabPageHeader/components/WalletConnectionGroup.tsx Outdated
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@PatrickChoo PatrickChoo requested a review from originalix March 10, 2026 09:29
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

7 similar comments
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

devin-ai-integration[bot]

This comment was marked as resolved.

@PatrickChoo PatrickChoo force-pushed the fix/hide-account-selector-no-wallet branch 3 times, most recently from 3d3c769 to 1ac035e Compare April 9, 2026 17:16
When deleting a wallet with multiple wallets present, the UI briefly
flashed the "No Wallet" empty state before auto-selecting the next
wallet. Use accountSelectorSyncLoadingAtom to show a spinner during
the async transition instead.

Also fix AndroidManifest intent tag with multiple data schemes.

OK-51091 OK-51094
…egression

- Add accountUtils.hasNoUsableWallet() to eliminate 5x duplicated logic
- Remove hideNoWalletTrigger from shared AccountSelectorTriggerBase to
  avoid hiding trigger in Swap/RewardCenter contexts
- Add platformEnv.isWebDappMode exclusion in WalletConnectionGroup and
  AccountSelectorTriggerHome to preserve Connect button in web dapp mode
- Show Spinner instead of blank state during sync loading in HomePageView
Every header/trigger consumer was hand-rolling the same
`syncLoading?.[num]?.isLoading` read after subscribing to the full
accountSelectorSyncLoadingAtom. Centralize it in a single hook so the
call sites stop copy-pasting the same nullable chain and the atom
subscription has a single place to swap in slot-keyed derivation later
if we ever need to narrow the re-render surface.

Applied to the six components that this PR already touches: HomePageView,
HeaderRight, MDHeader, WalletConnectionGroup, TabPageHeader/index,
AccountSelectorTriggerHome. The two DApp trigger variants
(NetworkSelectorTriggerDApp / AccountSelectorTriggerDApp) pair the read
with `|| mockIsLoading`, so they stay on the raw atom for now and are
out of scope.
- Remove hasNoUsableWallet from ITabPageHeaderProp, TabPageHeader,
  MDHeader, InPageHeader — each component now derives the value from
  useActiveAccount + accountUtils.hasNoUsableWallet
- Remove unnecessary useMemo wrapping trivial boolean check in
  WalletConnectionGroup and HomePageView
- Trim verbose comment on useIsAccountSelectorSyncLoading hook
- SelectorTrigger: add !platformEnv.isWebDappMode check for consistency
  with other guard sites, preventing accidental hiding in dapp mode
- HomePageView: extract NoWalletContent component to isolate
  isSyncLoading subscription, removing it from the homePage useMemo
  deps to avoid two full-page re-renders per wallet deletion
@PatrickChoo PatrickChoo marked this pull request as draft April 10, 2026 17:47
@PatrickChoo PatrickChoo force-pushed the fix/hide-account-selector-no-wallet branch from 1ac035e to a6a61d3 Compare April 10, 2026 17:50
@PatrickChoo
Copy link
Copy Markdown
Collaborator Author

Closing in favor of a clean PR with rebased commits and review fixes applied.

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.

4 participants