Skip to content

Conversation

@RichDom2185
Copy link
Member

Description

Redux has strongly encouraged to stop usage of "vanilla" Redux, and all the more this was emphasised with Redux 5 + RTK 2.0 release last December. This PR serves as a stepping stone to slowly migrate our codebase away from writing actions manually, and adopting redux toolkit.

Changes:

  • Install RTK v1 dependency
  • Reconfigure store using RTK (required first step to support type inference for subsequent steps)
  • Set up redux-sage middleware in RTK store (take note of a typing issue which will be supposedly fixed by Bump minor and patch versions of dependencies #2757)
  • Rewrite some actions to use RTK
    • Although once we fully adopt RTK, we no longer have to define the action creators and action types manually, we still need to migrate our actions to use createAction for now (and also use the prepare callback) in order to maintain compatibility with our existing reducers before they are migrated

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

Everything should still work.

Checklist

  • I have tested this code
  • I have updated the documentation

@RichDom2185 RichDom2185 self-assigned this Feb 3, 2024
@RichDom2185
Copy link
Member Author

This PR will also form the stepping stone to eventually move to RTK v2.

@coveralls
Copy link

coveralls commented Feb 3, 2024

Pull Request Test Coverage Report for Build 7985048069

Details

  • -18 of 173 (89.6%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 36.991%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/features/academy/AcademyActions.ts 5 6 83.33%
src/features/sourceRecorder/SourceRecorderActions.ts 13 14 92.86%
src/features/groundControl/GroundControlActions.ts 4 7 57.14%
src/commons/workspace/WorkspaceActions.ts 101 114 88.6%
Totals Coverage Status
Change from base Build 7984921253: -0.01%
Covered Lines: 5730
Relevant Lines: 14577

💛 - Coveralls

@RichDom2185 RichDom2185 requested a review from leeyi45 February 8, 2024 17:36
@RichDom2185 RichDom2185 mentioned this pull request Feb 18, 2024
7 tasks
Copy link
Contributor

@sayomaki sayomaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the changes!

@RichDom2185 RichDom2185 merged commit 976f275 into master Feb 21, 2024
@RichDom2185 RichDom2185 deleted the rtk-1 branch February 21, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants