Skip to content

Conversation

jacobo-dominguez-wgu
Copy link

Description

As part of Unit test improvement project, we replace all usages of the deprecated injectIntl HOC with the useIntl() hook from @edx/frontend-platform/i18n.
Closes #1591.
Class components were refactored into functional components in order to use the useIntl hook, and some unit tests related to them were modified to make them pass.

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

@jacobo-dominguez-wgu jacobo-dominguez-wgu added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Jul 31, 2025
@jacobo-dominguez-wgu jacobo-dominguez-wgu changed the title Replacement of injectIntl with useIntl part 1 refactor: replacement of injectIntl with useIntl part 1 Jul 31, 2025
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 31, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @jacobo-dominguez-wgu!

This repository is currently maintained by @openedx/2u-enterprise.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Jul 31, 2025
@jacobo-dominguez-wgu jacobo-dominguez-wgu requested a review from a team July 31, 2025 22:50
Copy link

codecov bot commented Aug 1, 2025

Codecov Report

❌ Patch coverage is 92.09040% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.87%. Comparing base (1067f26) to head (062c93d).

Files with missing lines Patch % Lines
src/components/Admin/AdminSearchForm.jsx 79.41% 7 Missing ⚠️
src/components/Admin/index.jsx 95.60% 3 Missing and 1 partial ⚠️
src/components/AdminV2/AdminSearchForm.jsx 91.17% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1635      +/-   ##
==========================================
- Coverage   86.88%   86.87%   -0.01%     
==========================================
  Files         798      798              
  Lines       18139    18107      -32     
  Branches     3809     3708     -101     
==========================================
- Hits        15760    15731      -29     
- Misses       2301     2309       +8     
+ Partials       78       67      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jacobo-dominguez-wgu jacobo-dominguez-wgu moved this from Needs Triage to Ready for Review in Contributions Aug 1, 2025
Copy link
Member

@brobro10000 brobro10000 left a comment

Choose a reason for hiding this comment

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

To the future reviewer, to facilitate validation of these changes, you can run the script to extract the fields from i18n

See

"i18n_extract": "fedx-scripts formatjs extract --throws",
for script info

npm run extract_i18n

@mphilbrick211 mphilbrick211 moved this from Ready for Review to In Eng Review in Contributions Aug 21, 2025
Copy link
Contributor

@kiram15 kiram15 left a comment

Choose a reason for hiding this comment

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

If it's not out of scope of this ticket, I think it would be good practice to include a description with every defaultMessage for the translators! Some of these examples have it and some don't

@jacobo-dominguez-wgu
Copy link
Author

If it's not out of scope of this ticket, I think it would be good practice to include a description with every defaultMessage for the translators! Some of these examples have it and some don't

It is a bit out of the scope, but I created an issue #1651 to achieve this shortly.

@jacobo-dominguez-wgu
Copy link
Author

Hi @brian-smith-tcril, could you take a look at this please?

Comment on lines 35 to 39
if (searchQuery !== prevSearchQuery || searchCourseQuery !== prevSearchCourseQuery
|| searchDateQuery !== prevSearchDateQuery || searchBudgetQuery !== prevSearchBudgetQuery
|| searchGroupQuery !== prevSearchGroupQuery) {
this.handleSearch();
}

Choose a reason for hiding this comment

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

Have you tested that this still works? It looks like this was calling handleSearch whenever any of the queries changed, but I only see a useEffect for searchEnrollmentsList.

Choose a reason for hiding this comment

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

You are right, I updated the useEffect to behave like the componentDidUpdate.

Choose a reason for hiding this comment

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

Interesting, I hadn't made it far enough down to see that there is an AdminSearchForm in the Admin directory and the AdminV2 directory. Do you know if both are being used?

Copy link
Author

@jacobo-dominguez-wgu jacobo-dominguez-wgu Sep 8, 2025

Choose a reason for hiding this comment

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

The files from both directories Admin and AdminV2 are being used in an AdminPage and AdminPageV2, but the AdminPage with the components from Admin directory is not being used anywhere in the repo. So It looks like the files inside Admin directory are deprecated.

Choose a reason for hiding this comment

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

@kiram15 can you provide some more context here? It looks like there's been recent activity on some components in both the Admin and AdminV2 directories, but only AdminPageV2 is being used.

I think instead of updating unused components, it likely makes more sense to remove AdminPage and any components that are only used by AdminPage, and then only handle the injectIntl -> useIntl in the components that are still in use.

Choose a reason for hiding this comment

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

Ok that make sense, I will wait on @kiram15 confirmation before proceeding.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I think removing the AdminPage and all related components are good! I will make sure that all the changes pushed related to it are mimicked in the AdminV2 directory!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). open-source-contribution PR author is not from Axim or 2U
Projects
Status: In Eng Review
Development

Successfully merging this pull request may close these issues.

Replace of injectIntl with useIntl() 1/4
5 participants