Skip to content

payment-link.screen: guard the deeplink request against superseded responses #1413

Description

@joshuakrueger-dfx

Context

Found in the review runs for PR #1275 (Codex logic lane). Pre-existing on develop — the block is outside every hunk of that PR, so it is reported rather than fixed there.

Evidence

src/screens/payment-link.screen.tsx (~157-172): the wallet-id effect calls getDeeplinkByWalletId(wallet.id) and writes in .then/.finally without a generation token or a mounted check.

  • On a fast switch of wallet-id, a late response for wallet A can call setWalletData({ ...A, deepLink }) after B was selected.
  • Its finally deletes the wallet-id parameter of the current state and clears isLoadingDeeplink, so the newer request loses its own URL parameter and its spinner.

Fix direction

Generation counter in a useRef, incremented per request and on unmount; apply state and URL updates only for the current generation. Precedent in this repository: src/hooks/safe.hook.ts:181-224, buy.screen.tsx.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions