Closed tptee closed 7 years ago
Merging #197 into master will decrease coverage by
0.86%
. The diff coverage is95.45%
.
@@ Coverage Diff @@
## master #197 +/- ##
=========================================
- Coverage 99.06% 98.2% -0.87%
=========================================
Files 19 18 -1
Lines 215 223 +8
=========================================
+ Hits 213 219 +6
- Misses 2 4 +2
Impacted Files | Coverage Δ | |
---|---|---|
src/types.js | 100% <100%> (ø) |
:arrow_up: |
src/environment/browser-router.js | 100% <100%> (ø) |
:arrow_up: |
src/actions.js | 100% <100%> (ø) |
:arrow_up: |
src/reducer.js | 100% <100%> (ø) |
:arrow_up: |
src/enhancer.js | 88.88% <75%> (-11.12%) |
:arrow_down: |
src/middleware.js | 95.23% <94.73%> (-4.77%) |
:arrow_down: |
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 98ce605...080b3c9. Read the comment docs.
Fixes https://github.com/FormidableLabs/redux-little-router/issues/165
Well this sucked...since
state
(andkey
) will always be undefined on the firsthistory
location, our piggybacking ofquery
andoptions
intostate
isn't a viable solution anymore (it was hacky anyway).The tricky part about integrating
history
is that data you attach to action creators don't necessarily make it to the reducer (history.listen
just spits out what the browser gives it).redux-thunk
would make this easier, but I don't want to require it or warn people about including it twice.I solved this with a LIFO queue of navigation actions in the reducer. For example: on
PUSH
, the reducer stores the payload at the end of the reducer'squeue
. OnLOCATION_CHANGED
, the reducer pops off the first payload from the queue and uses itsquery
andoptions
.The queue works because of these invariants:
history.listen
emits location changes in orderhistory
navigation method has a corresponding event emitted inhistory.listen
Would love if anyone could kick the tires on this in an existing project!