openedx / openedx/frontend-app-authoring
Move shared editor state from Redux to Context
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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