Skip to content

Commit

Permalink
Update eager state and reducer for render phase updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Feb 14, 2019
1 parent 2a62277 commit 6f44db2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-reconciler/src/ReactFiberHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,6 @@ function updateReducer<S, I, A>(
}

hook.memoizedState = newState;

// Don't persist the state accumlated from the render phase updates to
// the base state unless the queue is empty.
// TODO: Not sure if this is the desired semantics, but it's what we
Expand All @@ -616,6 +615,9 @@ function updateReducer<S, I, A>(
hook.baseState = newState;
}

queue.eagerReducer = reducer;
queue.eagerState = newState;

return [newState, dispatch];
}
}
Expand Down

0 comments on commit 6f44db2

Please sign in to comment.