Skip to content

fix: All Networks dead-end fallback (OK-57945)#12525

Open
weatherstar wants to merge 9 commits into
xfrom
fix/wallet-issues
Open

fix: All Networks dead-end fallback (OK-57945)#12525
weatherstar wants to merge 9 commits into
xfrom
fix/wallet-issues

Conversation

@weatherstar

@weatherstar weatherstar commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

OK-57945


Summary

  • Fall back to the first available single chain when the All Networks view is a dead end for the target wallet (QR wallet creation, wallet switching, and a pressable escape hatch in the home network trigger) (OK-57945)
  • Guard confirmAccountSelect against out-of-order commits: rapid successive selections now resolve latest-wins even when the async fallback query completes out of order (review feedback)

The OK-57069 Android history load-more patch was reverted from this PR after review discussion; it will be reworked separately.

Intent & Context

QA-reported wallet issue:

OK-57945: With a software wallet on All Networks whose enabled set contains only QR-unsupported chains (e.g. DOT only), creating a QR wallet lands home on All Networks with zero compatible networks. The home network selector renders a blank placeholder (no press target), and the all-network data pipeline has nothing to aggregate — the page dead-ends with no way for the user to escape. The same dead end existed when switching to an existing QR wallet, and via legacy persisted state on cold start.

Root Cause

OK-57945: createQrWallet forces the post-create selection to onekeyall without checking whether any enabled All Networks chain is compatible with the QR wallet; confirmAccountSelect similarly carries onekeyall over when switching wallets. AllNetworksManagerTrigger renders a non-pressable empty <Stack h={36}/> when the compatible enabled set is empty, so the user cannot recover from the UI.

Design Decisions

  • OK-57945 is fixed at three layers:
    • createQrWallet (onboarding): if no enabled All Networks chain is compatible with the new wallet, select the first created account's network instead of onekeyall (this restores previously commented-out fallback code, now gated on the compatibility check).
    • confirmAccountSelect (wallet switch): a new BG method getAllNetworksFallbackNetworkId returns the first wallet-compatible mainnet only when the All Networks view would be empty; the switch then goes through updateSelectedAccount so deriveType is re-fixed for the new network. Skipped in webDappMode (which forces All Networks by design). Writes are guarded by a per-scene latest-request id so a slower fallback query cannot overwrite a newer selection.
    • AllNetworksManagerTrigger (escape hatch for any residual path — cold-start legacy state, tray switches): when the compatible set is resolved and empty, render a pressable All Networks trigger that opens the unified network selector instead of a blank placeholder. A new isReady flag on the hook distinguishes "not resolved yet" (keeps the loading placeholder, no cold-start visual change) from "resolved but empty".
    • The compatibility computation mirrors the trigger hook exactly (enabled set ∩ wallet-compatible mainnets), so "fallback fires" ⟺ "trigger would have been blank".

Changes Detail

  • packages/kit-bg/src/services/ServiceAllNetwork/ServiceAllNetwork.ts: new BG methods getEnabledNetworksCompatibleWithWalletId and getAllNetworksFallbackNetworkId.
  • packages/kit/src/states/jotai/contexts/accountSelector/actions.tsx: All Networks dead-end fallback in createQrWallet (onboarding) and confirmAccountSelect (wallet switch), with a latest-request guard on the fallback write path.
  • packages/kit/src/hooks/useAllNetwork.ts: useEnabledNetworksCompatibleWithWalletIdInAllNetworks now returns isReady (initResult identity check; no behavior change for existing consumers).
  • packages/kit/src/components/AccountSelector/AllNetworksManagerTrigger.tsx: pressable escape-hatch trigger when the compatible enabled set is resolved and empty.
  • packages/kit/src/states/jotai/contexts/accountSelector/actions.test.tsx: 8 regression tests covering the createQrWallet fallback, confirmAccountSelect fallback, and out-of-order completion paths.

Comment thread packages/kit/src/states/jotai/contexts/accountSelector/actions.tsx
Comment thread patches/@react-native+virtualized-lists+0.81.5.patch Outdated
Comment thread patches/@react-native+virtualized-lists+0.81.5.patch Outdated
The pinned-to-bottom compensation will be reworked separately; this PR
keeps only the All Networks dead-end fallback.
Rapid successive selections under All Networks could commit out of
order because the fallback network query is async; guard writes with a
per-scene latest-request id and cover the reordering in a test.
@weatherstar weatherstar changed the title fix: All Networks dead-end fallback and Android history load-more(OK-57945, OK-57069) fix: All Networks dead-end fallback (OK-57945) Jul 16, 2026
@weatherstar
weatherstar requested a review from originalix July 16, 2026 11:32
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