Skip to content

Move shared editor state from Redux to Context #2091

@bradenmacdonald

Description

@bradenmacdonald

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    code healthProactive technical investment via refactorings, removals, etc.help wantedReady to be picked up by anyone in the community

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions