Skip to content

Conversation

@ahtesham-quraish
Copy link
Contributor

Description

Replace connect with useSelector() and useDispatch() 5/5 #2318

Supporting information

Link to other information about the change, such as GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.

Testing instructions

Please provide detailed step-by-step instructions for manually testing this change.

Other information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.

Best Practices Checklist

We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:

  • Any new files are using TypeScript (.ts, .tsx).
  • Deprecated propTypes, defaultProps, and injectIntl patterns are not used in any new or modified code.
  • Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
  • Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
  • Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
  • All new i18n messages in messages.ts files have a description for translators to use.
  • Imports avoid using ../. To import from parent folders, use @src, e.g. import { initializeMocks } from '@src/testUtils'; instead of from '../../../../testUtils'

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 4, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @ahtesham-quraish!

This repository is currently maintained by @bradenmacdonald.

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
🔘 Submit a signed contributor agreement (CLA)

⚠️ We ask all contributors to the Open edX project to submit a signed contributor agreement or indicate their institutional affiliation.
Please see the CONTRIBUTING file for more information.

If you've signed an agreement in the past, you may need to re-sign.
See The New Home of the Open edX Codebase for details.

Once you've signed the CLA, please allow 1 business day for it to be processed.
After this time, you can re-run the CLA check by adding a comment below that you have signed it.
If the CLA check continues to fail, you can tag the @openedx/cla-problems team in a comment for further assistance.

🔘 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.

Details
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 Sep 4, 2025
@ahtesham-quraish ahtesham-quraish force-pushed the ahtesham/#2318 branch 2 times, most recently from 1edb908 to eb34199 Compare September 4, 2025 09:51
@codecov
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.75%. Comparing base (b774084) to head (dfa0699).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2423      +/-   ##
==========================================
+ Coverage   94.71%   94.75%   +0.04%     
==========================================
  Files        1202     1202              
  Lines       26845    26816      -29     
  Branches     6025     6024       -1     
==========================================
- Hits        25425    25409      -16     
+ Misses       1350     1338      -12     
+ Partials       70       69       -1     

☔ 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.

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Needs Tests Run or CLA Signed in Contributions Sep 10, 2025
@brian-smith-tcril
Copy link
Contributor

I'm going to try closing and re-opening this PR to see if it resolves the CLA check issue

@github-project-automation github-project-automation bot moved this from Needs Tests Run or CLA Signed to Done in Contributions Sep 11, 2025
Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

@bradenmacdonald
Copy link
Contributor

@ahtesham-quraish Can you please also update the PR "Testing instructions" with instructions for how to test this manually? I want to make sure the editor components are still working after the refactor.

@ahtesham-quraish
Copy link
Contributor Author

@bradenmacdonald I have addressed the comments please check now. I normal follow Unit tests strategy to test the components behaviour and run regression test on all the relevant function/feature. Like in this case I see if all the component types which use texteditor are working.

const intl = useIntl();
const dispatch = useDispatch();

const openLanguages = useSelector(selectors.video.openLanguages);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to only import required selectors and thunk actions from the redux store instead of importing all selectors and thunk actions

Comment on lines +58 to +64
const launchDeleteConfirmation = jest.fn();
jest.spyOn(hooks, 'setUpDeleteConfirmation').mockReturnValue({
inDeleteConfirmation: false,
launchDeleteConfirmation,
cancelDelete,
});
render(<Transcript {...defaultProps} />);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this mocking is a duplicate because you are already mocking it beforeEach.

import { initializeMocks } from '@src/testUtils';
import { VideoPreviewWidget } from '.';

describe('VideoPreviewWidget', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason to change jsx file into tsx

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we are trying to migrate all code in this repo to TypeScript.

@awais-ansari
Copy link
Contributor

I have a few minor concerns, but overall, the PR looks good to me.

@bradenmacdonald
Copy link
Contributor

I normal follow Unit tests strategy to test the components behaviour and run regression test on all the relevant function/feature. Like in this case I see if all the component types which use texteditor are working.

I meant manual testing. Making sure it actually works by using it yourself. This PR is mostly affecting the Video editor, not the text editor. When I tried the "Add Transcript" button in the video editor, there is a new bug that wasn't happening before:

Transcript.Error.mov

Please fix that, and the duplicate mock that @awais-ansari pointed out, and then I think this is ready.

@bradenmacdonald
Copy link
Contributor

@ahtesham-quraish are you planning to finish this?

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

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants