popcodeorg / popcodeorg/popcode
Implement reducers with handleActions
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 191
- Fork
- 143
- Merge medio
- 4g 11h
- PR unite (30g)
- 5
Descrizione
Currently most of our reducers are implemented as a big switch statement, which is unwieldy and hard to read. Instead, use the handleActions() helper in redux-actions to implement the reducer as a map of action names to reducer functions.
We should follow the pattern of using the action creator function itself as the map key, allowing us to avoid hard-coding string literals containing the action name.
See the console reducer for an example of the desired implementation.
Testing
Since our goal here is merely to refactor the reducers, not change their behavior, all existing tests should pass after a reducer is refactored.
However, it might make sense to also port the reducer test to Jest after completing the refactor and confirming that the old tests pass with the new reducer implementation (this should be in separate commits).
Reducers to migrate
-
clients -
compiledProjects -
console -
currentProject -
errors -
googleClassroom -
index -
projects -
resizableFlex -
ui -
user
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con l’esempio completato in src/reducers/console.js, quindi individua i reducer non ancora verificati clients, compiledProjects, currentProject, errors, googleClassroom, index, projects e user. Esegui il refactoring con redux-actions preservando il comportamento ed esegui tutti i test esistenti per confermare che continuino a passare; lascia il porting dei test Jest a una modifica separata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, redux
- Ambito
- frontend
- Tipo di issue
- Refactoring
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100