Skip to content

Commit

Permalink
fix(Carpenter): use componentWillMount when having components with …
Browse files Browse the repository at this point in the history
…initial actions
  • Loading branch information
arthurxavierx committed Sep 15, 2016
1 parent bc15241 commit d340858
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Carpenter.purs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ spec state update render = React.spec state (getReactRender update render)
-- | Constructs a React component spec based on an initial state,
-- | an initial action, an update function and a render function.
spec' :: state props action eff. state -> action -> Update state props action eff -> Render state props action -> React.ReactSpec props state eff
spec' state action update render = (React.spec state (getReactRender update render)) { componentDidMount = componentDidMount }
spec' state action update render = (React.spec state (getReactRender update render)) { componentWillMount = componentWillMount }
where
componentDidMount :: React.ComponentDidMount props state eff
componentDidMount this = void $ do
componentWillMount :: React.ComponentWillMount props state eff
componentWillMount this = void $ do
props <- React.getProps this
state <- React.readState this
let yield = mkYielder this
Expand Down
6 changes: 3 additions & 3 deletions src/Carpenter/Cedar.purs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ cedarSpec'
-> React.ReactSpec (CedarProps state action) state eff
cedarSpec' action update render = reactSpec
{ componentWillReceiveProps = componentWillReceiveProps
, componentDidMount = componentDidMount
, componentWillMount = componentWillMount
}
where
reactSpec :: React.ReactSpec (CedarProps state action) state eff
Expand All @@ -83,8 +83,8 @@ cedarSpec' action update render = reactSpec
componentWillReceiveProps :: React.ComponentWillReceiveProps (CedarProps state action) state eff
componentWillReceiveProps this props = void $ React.writeState this props.initialState

componentDidMount :: React.ComponentDidMount (CedarProps state action) state eff
componentDidMount this = void $ do
componentWillMount :: React.ComponentWillMount (CedarProps state action) state eff
componentWillMount this = void $ do
props <- React.getProps this
state <- React.readState this
let yield = mkYielder this
Expand Down

0 comments on commit d340858

Please sign in to comment.