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 22 forks source link

Generate snapshots as needed. Remove append event subscription #438

Closed nhunzaker closed 6 years ago

nhunzaker commented 6 years ago

What:

Microcosm History emits an append event that tells its associated Microcosms that it needs to create a snapshot. We can lazily generate snapshots as they are needed, allowing us to get rid of that event.

Why:

I am trying to move internals over to observables, which more accurately describe how Microcosms and Actions work. To do that, I need to eliminate a few events, particularly in History.

Basically I'm trying to get everything to work via a single change event type, which could eventually be replaced with the observable lifecycle:

  1. start (setup microcosm hook)
  2. next (change microcosm hook)
  3. complete (teardown microcosm hook)
  4. error (handled via actions)
codecov-io commented 6 years ago

Codecov Report

Merging #438 into master will increase coverage by 7.03%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #438      +/-   ##
==========================================
+ Coverage    70.2%   77.23%   +7.03%     
==========================================
  Files          44       44              
  Lines        1376     1362      -14     
  Branches      258      251       -7     
==========================================
+ Hits          966     1052      +86     
+ Misses        339      257      -82     
+ Partials       71       53      -18
Impacted Files Coverage Δ
packages/microcosm/src/history.js 100% <ø> (ø) :arrow_up:
packages/microcosm/src/microcosm.js 100% <100%> (ø) :arrow_up:
packages/microcosm/src/addons/action-button.js 100% <0%> (+100%) :arrow_up:
packages/microcosm/src/addons/action-queue.js 100% <0%> (+100%) :arrow_up:
packages/microcosm/src/addons/indexing.js 100% <0%> (+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 b165b47...3bdd440. Read the comment docs.