openedx / openedx/frontend-app-authoring

Remove Higher Order Components from Editors

Open
#2,089 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

code health good first issue help wanted
Dominant language
TypeScript
Stars
17
Forks
218
Avg merge
9d 20h
Merged PRs (30d)
20

Description

In src/editors/...

  1. Replace injectIntl with useIntl() -> https://github.com/openedx/frontend-app-authoring/issues/2280
  2. Replace usage of connect with useSelector() and useDispatch() -> https://github.com/openedx/frontend-app-authoring/issues/2312
  3. Update the code and tests to get rid of the Internal export pattern:
    Example of exporting (Component)Internal and Component = injectIntl(connect(...)) HOCs, then testing with the Internal one.

https://github.com/openedx/frontend-app-authoring/blob/5df4cd941d176949a813146908dfcc3d6df2f915/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/AnswerOption.jsx#L173-L174

https://github.com/openedx/frontend-app-authoring/blob/5df4cd941d176949a813146908dfcc3d6df2f915/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/AnswerOption.test.jsx#L6

Once the HOCs (injectIntl, connect) are replaced with hooks, if it's necessary to mock redux state in tests, convert the tests to use initializeMocks from src/testUtils.tsx and pass in initialState to initializeMocks. Or use const { reduxStore } = initializeMocks(); and dispatch changes to the redux store.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing src/editors/ and the AnswerOption.jsx and AnswerOption.test.jsx examples, then read src/testUtils.tsx and the linked injectIntl and connect issues. Update the editor code and tests to use hooks and remove the Internal export pattern; use initializeMocks when tests need Redux state. Done means the listed HOCs and Internal exports are no longer needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, redux, typescript
Domain
frontend, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.