Skip to content

Commit c3cb78d

Browse files
fix: fixed evaluateCohortEligibility call in home page (#37803)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR fixed evaluateCohortEligibility call in home page just after the onboarding is completed. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/37803?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: fixed evaluateCohortEligibility call in home page just after the onboarding is completed. ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Wires `isSignedIn` into Home and only triggers pending Shield cohort evaluation when the user is signed in. > > - **Home (`ui/pages/home/home.component.js`)**: > - Gate `evaluateCohortEligibility` call behind `isSignedIn` in `componentDidUpdate`. > - Add `PropTypes.bool` for new prop `isSignedIn`. > - **Container (`ui/pages/home/home.container.js`)**: > - Map `state.metamask.isSignedIn` to `isSignedIn` prop passed to `Home`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c7a6fa6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Chaitanya Potti <chaitanya.potti@gmail.com>
1 parent 4bdb5f7 commit c3cb78d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ui/pages/home/home.component.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export default class Home extends PureComponent {
177177
evaluateCohortEligibility: PropTypes.func,
178178
pendingShieldCohort: PropTypes.string,
179179
setPendingShieldCohort: PropTypes.func,
180+
isSignedIn: PropTypes.bool,
180181
};
181182

182183
state = {
@@ -313,6 +314,7 @@ export default class Home extends PureComponent {
313314
pendingShieldCohort,
314315
evaluateCohortEligibility,
315316
setPendingShieldCohort,
317+
isSignedIn,
316318
} = this.props;
317319

318320
const {
@@ -338,8 +340,8 @@ export default class Home extends PureComponent {
338340
this.checkStatusAndNavigate();
339341
}
340342

341-
// Check for pending Shield cohort evaluation
342-
if (pendingShieldCohort && evaluateCohortEligibility) {
343+
// Check for pending Shield cohort evaluation if user is signed in
344+
if (pendingShieldCohort && evaluateCohortEligibility && isSignedIn) {
343345
setPendingShieldCohort(null);
344346
evaluateCohortEligibility(pendingShieldCohort);
345347
}

ui/pages/home/home.container.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ const mapStateToProps = (state) => {
196196
showShieldEntryModal: getShowShieldEntryModal(state),
197197
isSocialLoginFlow: getIsSocialLoginFlow(state),
198198
pendingShieldCohort: getPendingShieldCohort(state),
199+
isSignedIn: state.metamask.isSignedIn,
199200
};
200201
};
201202

0 commit comments

Comments
 (0)