Skip to content

Commit

Permalink
Merge pull request #25 from shiftyp/bug/#24-nested-state
Browse files Browse the repository at this point in the history
#24: Fixed nested state updates by creating new pausers for each tree node
  • Loading branch information
shiftyp authored Nov 6, 2016
2 parents 37f46d0 + 449436d commit b8abdff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 3 additions & 4 deletions lib/state/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,14 @@ export const createFinalTreeFromProvisionalNode = ({

const createInitialTree = ({
initialState,
pauser,
rootPauser,
hookMap,
createNode,
provisional,
provisionalNode
}) => {
if (!pauser) {
pauser = new Rx.BehaviorSubject(true);
}
const pauser = new Rx.BehaviorSubject(true);
if (rootPauser) rootPauser.subscribe(pauser.onNext.bind(pauser));
if (!hookMap) {
hookMap = new WeakMap();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redurx",
"version": "0.4.0",
"version": "0.4.1",
"description": "Redux'ish Functional State Management using RxJS",
"keywords": [
"redurx",
Expand Down
8 changes: 6 additions & 2 deletions test/state/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ test('should be able to hook into tree node', t => {
const testVal = 42;
const initialVal = {
a: 1,
b: 2
b: {
val: 2
}
};
const finalVal = {
a: 43,
b: 44
b: {
val: 53
}
};
const state = createState();
const action = new Rx.Subject();
Expand Down

0 comments on commit b8abdff

Please sign in to comment.