openedx / openedx/frontend-app-authoring

Move shared editor state from Redux to Context

Open
#2,091 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The editors use Redux to store their state, and it can be hard to reason about.

Expanding on previous work, state that's used by all the editors (i.e. the app state) should be moved into EditorContext.

Example:

🛑 Old:

const learningContextId = useSelector(selectors.app.learningContextId);

🛑 Very old!

mapStateToProps = (state) => ({
  learningContextId: selectors.app.learningContextId(state), ...

🛑 Very old! (no need to pass these as props ("prop drilling"); just get them from context wherever you need them)

VideoSelector.propTypes = {
  learningContextId: PropTypes.string.isRequired, ...

✅ New:

const { learningContextid } = useEditorContext();

Note: I'm not sure if everything in the app state is used by more than one editor. So check as you go.

PRs:

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 with src/editors/data/redux/index.ts, especially the app state, and src/editors/EditorContext.tsx. Search the editors for uses of app state and determine which values are shared; done means shared values come from EditorContext rather than Redux or prop drilling, with the existing pull request providing relevant context.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.