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

Framework: Fix change detection to maintain multiple instances of state #3544

Merged
merged 1 commit into from Nov 20, 2017

Conversation

Projects
None yet
2 participants
@aduth
Member

aduth commented Nov 18, 2017

This pull request seeks to improve the withChangeDetection higher-order reducer to resolve an issue where state is maintained between invocations of the original reducer, whether or not those invocations occur within the same store instance. Notably, this becomes an issue if there are multiple instances of Redux stores sharing the same reducer. The previous behavior was not pure, which has been remedied with the changes here. The only downside is that isDirty does not revert back to false if the state resets to its original reference. Since this would be a very rare occurrence anyways, it is a reasonable sacrifice. The only other option I could consider was to maintain both current and original states in an injected subtree of state.

Testing instructions:

Ensure unit tests pass:

npm test

Verify that there are no regressions in the behavior of saved state dirty detection.

  1. New posts should not have unsaved changes
  2. Changes should flag a post as needing save
  3. Saving a post should reset to no unsaved changes after completion

@aduth aduth added the Framework label Nov 18, 2017

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Nov 18, 2017

Codecov Report

Merging #3544 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3544      +/-   ##
==========================================
- Coverage    34.9%   34.88%   -0.02%     
==========================================
  Files         263      263              
  Lines        6727     6725       -2     
  Branches     1227     1225       -2     
==========================================
- Hits         2348     2346       -2     
  Misses       3694     3694              
  Partials      685      685
Impacted Files Coverage Δ
editor/utils/with-change-detection/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1709207...5660eb0. Read the comment docs.

codecov bot commented Nov 18, 2017

Codecov Report

Merging #3544 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3544      +/-   ##
==========================================
- Coverage    34.9%   34.88%   -0.02%     
==========================================
  Files         263      263              
  Lines        6727     6725       -2     
  Branches     1227     1225       -2     
==========================================
- Hits         2348     2346       -2     
  Misses       3694     3694              
  Partials      685      685
Impacted Files Coverage Δ
editor/utils/with-change-detection/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1709207...5660eb0. Read the comment docs.

@aduth aduth merged commit 6f5e90c into master Nov 20, 2017

3 checks passed

codecov/project Absolute coverage decreased by -0.01% but relative coverage increased by +65.09% compared to 1709207
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@aduth aduth deleted the fix/change-detection-multi-reduce branch Nov 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment