Skip to content

chore(runway): cherry-pick fix: prevent unnecessary reward navigation on account change#21277

Merged
Cal-L merged 3 commits into
release/7.57.0from
cherry-pick-7-57-0-bffddee
Oct 16, 2025
Merged

chore(runway): cherry-pick fix: prevent unnecessary reward navigation on account change#21277
Cal-L merged 3 commits into
release/7.57.0from
cherry-pick-7-57-0-bffddee

Conversation

@runway-github

@runway-github runway-github Bot commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

Description

When you reinstalled the app and reimported an SRP where the first
account/group was tied to the rewards program, you wouldn't see the
rewards gtm modal as its logic wouldn't trigger. In the same session,
when switching to an account that wasn't tied to the rewards program
yet, the gtm modal would trigger a navigation to the onboarding/gtm
modal but then we'd detect that there was opted in for another/other
accounts (i.e. primary) and the rewards dashboard would be seen.

To prevent this, in the logic that spawns the gtm modal, as soon as we
detect a subscriptionId, we set the gtm modal seen storage prop to
true, preventing it to be spawned/navigated to when changing an account
that had no subscriptionId.

Minor extra fix; as we're moving ahead with prod readiness, we are
switching the geo check URI to prod.

Changelog

CHANGELOG entry: null

Related issues

Fixes: #21252

Manual testing steps

  1. Reinstall app
  2. import existing SRP where primary account (first) is already opted in
    to rewards program but second/other accounts not
  3. the primary view/wallet view will load and no gtm modal should open
  4. switch to an account that is not tied to the rewards program.
  5. Before this fix, you would've been redirected to the rewards program.
    With this fix, nothing should happen.

Note

Marks the rewards GTM intro as seen on intro mount and when a subscription exists to avoid unwanted navigation, and switches geolocation to the PROD endpoint; updates tests accordingly.

  • Rewards Onboarding:
    • Move setting REWARDS_GTM_MODAL_SHOWN to Onboarding/OnboardingIntroStep.tsx on mount; simplify RewardsIntroModal.tsx to presentation-only.
    • In useRewardsIntroModal.ts, set REWARDS_GTM_MODAL_SHOWN when subscriptionId exists to prevent GTM modal navigation on account switch.
  • Services:
    • rewards-data-service.fetchGeoLocation() now always uses GEOLOCATION_URLS.PROD.
  • Tests:
    • Update onboarding modal/intro tests to reflect storage logic move and new storage interactions.
    • Adjust geolocation tests to expect PROD URL regardless of environment.

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

bffddee

#21264)

When you reinstalled the app and reimported an SRP where the first
account/group was tied to the rewards program, you wouldn't see the
rewards gtm modal as its logic wouldn't trigger. In the same session,
when switching to an account that wasn't tied to the rewards program
yet, the gtm modal would trigger a navigation to the onboarding/gtm
modal but then we'd detect that there was opted in for another/other
accounts (i.e. primary) and the rewards dashboard would be seen.

To prevent this, in the logic that spawns the gtm modal, as soon as we
detect a `subscriptionId`, we set the gtm modal seen storage prop to
true, preventing it to be spawned/navigated to when changing an account
that had no `subscriptionId`.

Minor extra fix; as we're moving ahead with prod readiness, we are
switching the geo check URI to prod.

CHANGELOG entry: null

Fixes: #21252

1. Reinstall app
2. import existing SRP where primary account (first) is already opted in
to rewards program but second/other accounts not
3. the primary view/wallet view will load and no gtm modal should open
4. switch to an account that is not tied to the rewards program.
5. Before this fix, you would've been redirected to the rewards program.
With this fix, nothing should happen.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Marks the rewards intro modal as seen when a subscription exists and
on intro step mount to prevent unwanted navigation, simplifies the intro
modal, and forces the geolocation service to use the PROD URL; tests
updated accordingly.
>
> - **Rewards Onboarding**:
> - Move `REWARDS_GTM_MODAL_SHOWN` persistence to `OnboardingIntroStep`
(set on mount) and simplify `RewardsIntroModal` to be presentational
only.
> - In `useRewardsIntroModal`, if `subscriptionId` exists, set
`REWARDS_GTM_MODAL_SHOWN` to `true` and skip navigation.
> - Minor robustness: swallow errors in
`RewardsController:isOptInSupported` check.
> - **Services**:
> - `RewardsDataService.fetchGeoLocation` now always uses
`GEOLOCATION_URLS.PROD`.
> - **Tests**:
> - Update/relocate storage expectations to `OnboardingIntroStep` and
`useRewardsIntroModal`.
> - Adjust geolocation tests to expect PROD URL irrespective of
environment.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
63407dd. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@runway-github runway-github Bot requested a review from a team as a code owner October 16, 2025 11:44
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

cursor[bot]

This comment was marked as outdated.

@sonarqubecloud

Copy link
Copy Markdown

@Cal-L Cal-L 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.

LGTM

@Cal-L Cal-L merged commit 843d89f into release/7.57.0 Oct 16, 2025
153 of 157 checks passed
@Cal-L Cal-L deleted the cherry-pick-7-57-0-bffddee branch October 16, 2025 19:24
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 16, 2025
@metamaskbot metamaskbot added the release-7.57.0 Issue or pull request that will be included in release 7.57.0 label Oct 16, 2025
@metamaskbot

Copy link
Copy Markdown
Collaborator

No release label on PR. Adding release label release-7.57.0 on PR, as PR was cherry-picked in branch 7.57.0.

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

Labels

release-7.57.0 Issue or pull request that will be included in release 7.57.0 size-M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants