Skip to content

Fix wrong asset on "Sent!" screen after switching token mid-send - #2873

Merged
CassioMG merged 1 commit into
masterfrom
fix/2871-send-wrong-asset-on-success
Jun 26, 2026
Merged

Fix wrong asset on "Sent!" screen after switching token mid-send#2873
CassioMG merged 1 commit into
masterfrom
fix/2871-send-wrong-asset-on-success

Conversation

@CassioMG

@CassioMG CassioMG commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #2871.

Opening Send from a token's detail page keeps ?asset=<token> in the URL for the whole (linearized) flow. useSendQueryParams re-applied that param on every effect run, and its deps include the collections cache — which refreshes on a successful submit. So switching to another token mid-flow was reverted to the URL token right at the "Sending…" → "Sent!" transition, and the success screen (which reads transactionData.asset) showed the wrong token. 100% reproducible.

The currentAssetRef guard added in #2764 only covered the no-param / invalid-param branches — not the valid-param branch that does the reverting. This gates the destination/asset URL pre-population on an actual location.search change, so re-runs from other deps no longer clobber an in-flow selection. The collectible block still re-runs (it needs asynchronously-loaded collections).

Regression test added.

🤖 Generated with Claude Code

Screen.Recording.2026-06-25.at.13.09.38.mov

…id-send (#2871)

When Send is opened from a token's detail page, the URL carries
?asset=<that token> for the entire (linearized) flow. useSendQueryParams'
effect re-dispatched saveAsset(<URL asset>) on every run, and its deps include
the collections cache — which refreshes on a successful submit. So switching to
a different token mid-flow was silently reverted to the URL token exactly at the
"Sending..." -> "Sent!" transition, and the success screen (which reads
transactionData.asset) showed the wrong token. 100% reproducible.

The existing currentAssetRef guard only covered the no-param / invalid-param
branches, not the valid-param branch that does the reverting. Gate the
destination/asset URL pre-population on an actual location.search change via a
lastAppliedSearchRef, so re-runs from other dependencies no longer clobber an
asset/destination the user changed mid-flow. The collectible block still re-runs
(it depends on collections loading asynchronously).

Adds a regression test reproducing the revert.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 25, 2026 16:11
@CassioMG CassioMG changed the title [Extension] Fix wrong asset on "Sent!" screen after switching token mid-send Fix wrong asset on "Sent!" screen after switching token mid-send Jun 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Preview build is ready: https://github.com/stellar/freighter/releases/tag/untagged-1dfd858e8564195ee12f (SDF collaborators only — install instructions in the release description)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes an extension Send-flow regression where the ?asset= query param could be re-applied after a successful submit (due to effect re-runs from cache refreshes), causing the “Sent!” success screen to display the wrong asset when the user switched tokens mid-flow.

Changes:

  • Add a lastAppliedSearchRef guard in useSendQueryParams so URL destination/asset pre-population only runs when location.search actually changes (while keeping collectible handling reactive to async collection loading).
  • Add a regression unit test that simulates an in-flow asset switch followed by an unrelated cache update, asserting the user-selected asset is not clobbered.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
extension/src/popup/views/Send/hooks/useSendQueryParams.ts Prevents URL query param re-application on non-URL-driven effect re-runs by tracking the last applied location.search.
extension/src/popup/views/Send/hooks/tests/useSendQueryParams.test.tsx Adds a regression test reproducing issue #2871 to ensure switched in-flow asset selection persists across unrelated store updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CassioMG CassioMG self-assigned this Jun 25, 2026
@piyalbasu

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@piyalbasu piyalbasu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This LGTM!

@CassioMG
CassioMG merged commit 21dac28 into master Jun 26, 2026
12 checks passed
@CassioMG
CassioMG deleted the fix/2871-send-wrong-asset-on-success branch June 26, 2026 01:27
@github-actions github-actions Bot mentioned this pull request Jul 7, 2026
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.

Wrong asset shown on "sent success" screen

3 participants