Closed nhunzaker closed 6 years ago
:exclamation: No coverage uploaded for pull request base (
master@fbd3d38
). Click here to learn what that means. The diff coverage is97.56%
.
@@ Coverage Diff @@
## master #519 +/- ##
=========================================
Coverage ? 93.73%
=========================================
Files ? 32
Lines ? 798
Branches ? 162
=========================================
Hits ? 748
Misses ? 43
Partials ? 7
Impacted Files | Coverage Δ | |
---|---|---|
packages/microcosm/src/ledger.js | 100% <100%> (ø) |
|
packages/microcosm/src/subject.js | 100% <100%> (ø) |
|
packages/microcosm/src/domain.js | 100% <100%> (ø) |
|
packages/microcosm/src/coroutine.js | 100% <100%> (ø) |
|
packages/microcosm/src/agent.js | 100% <100%> (ø) |
|
packages/microcosm/src/lifecycle.js | 100% <100%> (ø) |
|
packages/microcosm/src/observable.js | 88.13% <94.73%> (ø) |
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 fbd3d38...a5ee630. Read the comment docs.
@zporter Thanks! Honestly, as stop and go as this has been, they've been super helpful for me too.
Thanks again, @zporter!
What
As a part of the Microcosm 13 update, actions are moving away from a custom data type and embrace the Observable standard interface. Unfortunately, that causes a few API incompatibilities that I'm trying to smooth over before a full release of 13.x.
In Microcosm 12.x, you can complete an action with a payload like:
As far as I understand, with Observables, the correct way to accomplish this is something like:
While I've respected that for Observables themselves, this PR updates the Subject API to allow passing a payload to
complete
. This improves ergonomics and compatibility with usage in Microcosm 12.x.Other related work
The drawback to this approach is that an extra action status is dispatched. I have alleviated that by adding a
filter
method to the Observable prototype that Domains use to avoid dispatch if an action update has no impact on their state. Essentially:This actually ended up being a greater efficiency update than I anticipated, allowing me to unskip a few tests. Pretty neat. I've been wanting to add
filter
to the core API, but was wary of doing so until I could dogfood it internally. Now I can!