You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Explanation
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:
* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->
- Previously `triggerAccessTokenRefresh` was only called during
`getSubscriptions` polling, normal subscription state change didn't
trigger it.
This PR trigger `triggerAccessTokenRefresh` everytime subscription state
change
- Remove `triggerAccessTokenRefresh` from
`startShieldSubscriptionWithCard` since that only return stripe checkout
url, not subscribed yet.
## References
<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?
For example:
* Fixes #12345
* Related to #67890
-->
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Refresh access token immediately when subscription state changes and
remove refresh after starting card/crypto checkout; delete polling
flag/logic.
>
> - **Subscription Controller**:
> - **Behavior**: Call `triggerAccessTokenRefresh` in `getSubscriptions`
whenever state changes (subscriptions/customer/trials/lastSubscription).
> - **Refactor**: Remove `#shouldCallRefreshAuthToken` and related
polling conditional; `_executePoll` now only calls `getSubscriptions`.
> - **Flows**: Remove `triggerAccessTokenRefresh` after
`startShieldSubscriptionWithCard` and `startSubscriptionWithCrypto`
(checkout/session creation only).
> - **Docs**:
> - Update `CHANGELOG.md` to reflect the new refresh behavior and
removal after card checkout.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
04b3ce9. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Copy file name to clipboardExpand all lines: packages/subscription-controller/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Changed
11
+
12
+
- Trigger `triggerAccessTokenRefresh` everytime subscription state change instead of only when polling ([#7149](https://github.com/MetaMask/core/pull/7149))
13
+
- Remove `triggerAccessTokenRefresh` after `startShieldSubscriptionWithCard` ([#7149](https://github.com/MetaMask/core/pull/7149))
// note: no need to trigger access token refresh after startSubscriptionWithCard request because this only return stripe checkout session url, subscription not created yet
471
469
472
470
returnresponse;
473
471
}
@@ -476,7 +474,7 @@ export class SubscriptionController extends StaticIntervalPollingController()<
0 commit comments