Skip to content

Temporary fix to resolve RTK freezing reducer states #2818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2024

Conversation

sayomaki
Copy link
Contributor

@sayomaki sayomaki commented Feb 24, 2024

Description

As of dcd2c69, the playground code evaluation seems to have been broken and unusable. This is caused by the fact that Redux Toolkit uses immer as their state manager. By design of immer, it will auto freeze states causing mutations to fail, even in production.

Thus, as we are still in the progress in migrating to RTK, and that various current sagas and actions still depend on these state mutations to work correctly (i.e. code evaluation), it will be good to explicitly disable auto-freezing of the state until the reducer/actions depending on state mutations get refactored.

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

Ensure that playground code evaluates as normal, and that modules work as intended.

Checklist

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

@sayomaki sayomaki requested a review from RichDom2185 February 24, 2024 07:44
@RichDom2185
Copy link
Member

Fixes the regression introduced in #2789.

Copy link
Member

@martin-henz martin-henz left a comment

Choose a reason for hiding this comment

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

Looks good!

@RichDom2185 RichDom2185 enabled auto-merge (squash) February 24, 2024 07:48
@RichDom2185
Copy link
Member

Additional context: refer to https://immerjs.github.io/immer/freezing/

@coveralls
Copy link

coveralls commented Feb 24, 2024

Pull Request Test Coverage Report for Build 8029163485

Details

  • 0 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.002%) to 37.214%

Files with Coverage Reduction New Missed Lines %
src/commons/sagas/SafeEffects.ts 1 79.41%
Totals Coverage Status
Change from base Build 8028692964: -0.002%
Covered Lines: 5811
Relevant Lines: 14693

💛 - Coveralls

@RichDom2185 RichDom2185 merged commit b88bc91 into source-academy:master Feb 24, 2024
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