vigetlabs / microcosm

Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.
http://code.viget.com/microcosm/
MIT License
487 stars 29 forks source link

Fix edge case with patch/reset. Add dispatch optimization. #508

Closed nhunzaker closed 6 years ago

nhunzaker commented 6 years ago

Adds two fixes/optimizations:

[microcosm] Patch and Reset only trigger on complete

This commit fixes a bug where patch and reset would trigger on every state update. I only noticed this after doing some work on a scheduler for Microcosm, which has some improvements in error handling.

[microcosm] Do not process actions that are only started

This commit commit adds an optimization to domain dispatch that prevents the ledger from assigning state for actions that have only started, but have no progress.

codecov-io commented 6 years ago

Codecov Report

Merging #508 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #508      +/-   ##
==========================================
+ Coverage   99.69%   99.69%   +<.01%     
==========================================
  Files          27       27              
  Lines         659      665       +6     
  Branches      130      131       +1     
==========================================
+ Hits          657      663       +6     
  Misses          2        2
Impacted Files Coverage Δ
packages/microcosm/src/domain.js 100% <100%> (ø) :arrow_up:

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 7b31736...4ba7908. Read the comment docs.

nhunzaker commented 6 years ago

Thanks, @zporter!