processing / processing/p5.js-web-editor
`mapStateToProps` and `mapDispatchToProps` often include unused props
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 1.7k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 8
Description
Related to #824 and #2042
I've noticed that a lot of components are accessing props through the Redux connect HOC which are not actually used in the component itself. The mapStateToProps and mapDispatchToProps don't get checked for unnecessary fields in the way that the PropTypes definitions do so it can be hard to spot them.
For example, the IDEView gets the editorAccessibility state and all EditorAccessibilityActions but does not use any of them.
The bulk importing of action creator objects with the import * as EditorAccessibilityActions from '../actions/editorAccessibility'; syntax makes it extra difficult to see which of those actions, if any, are actually used.
This is one of many reasons that the hooks are better, but we still have a lot of class component that can't use hooks yet.
FYI, the mapDispatchToProps setup with bindActionCreators is not necessary because you can use the object notation to pass the action creators without binding.
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 by inspecting the IDEView connection and the ../actions/editorAccessibility module mentioned in the issue. Then identify other class components whose mapStateToProps or mapDispatchToProps entries are unused. Done means unnecessary mapped props are removed without changing component behavior, with the existing relevant tests still passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100