processing / processing/p5.js-web-editor

Refactoring Redux code: hooks, thunks, and redux-toolkit

Open
#2,042 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement Priority:High Type:Task
Dominant language
JavaScript
Stars
1.7k
Forks
1.7k
Avg merge
3d 4h
Merged PRs (30d)
8

Description

Most of the Redux code is this package was written years ago and has not been touched since. In that time, Redux has come a long way! The bad news is that this codebase goes against a lot of the Redux Best Practices. The good news is that the newer ways of doing things are much easier and involve a lot less boilerplate.

Some things which can be improved/changed:

  • Can use createSlice which automatically creates the action creators for a reducer so that you don't need to define a bajillion constants or define basic action creator functions. This can be tackled one "slice" at a time, as Redux Toolkit is fully compatible with old/vanilla Redux.
  • Can use createAsyncThunk to automatically dispatch pending, error and fulfilled actions for each asynchronous action.
  • Can use useSelector and useDispatch hooks instead of the connect HOC.

I can do a lot of this myself, but I wanted to post it as a discussion first because I don't want to waste time rewriting code if it's not wanted.

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

The issue identifies the Redux codebase and constants.js but does not name a specific reducer, test, or entry point. Start by reviewing those areas against the linked Redux Best Practices, then clarify the intended slice or migration scope; done would require an agreed, tested modernization plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, redux
Domain
frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.