popcodeorg / popcodeorg/popcode
Implement reducers with handleActions
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 191
- Fork
- 143
- Merge trung bình
- 4 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 5
Mô tả
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
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với ví dụ đã hoàn thành trong src/reducers/console.js, sau đó tìm các reducer chưa được kiểm tra clients, compiledProjects, currentProject, errors, googleClassroom, index, projects và user. Refactor chúng bằng redux-actions trong khi vẫn giữ nguyên hành vi, rồi chạy tất cả các test hiện có để xác nhận rằng chúng vẫn pass; để việc chuyển đổi các test Jest cho một thay đổi riêng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, redux
- Lĩnh vực
- frontend
- Loại issue
- Tái cấu trúc
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100