@@ -61,27 +61,26 @@ export default class Spring extends React.Component {
6161  } 
6262
6363  state  =  {  props : undefined  } 
64-   animations  =  { } 
6564
6665  componentWillUnmount ( )  { 
6766    this . stop ( ) 
6867  } 
6968
7069  componentWillMount ( )  { 
71-     this . updatePropsAsync ( this . props ) 
70+     this . animations  =  { } 
71+     this . mounting  =  true 
72+     this . inject  =  this . props . inject  &&  this . props . inject ( this ,  this . props ) 
73+     if  ( this . inject )  return 
74+     this . updateProps ( this . props ) 
7275  } 
7376
7477  componentWillUpdate ( props )  { 
75-     if  ( props . reset  ||  shallowDiff ( props . to ,  this . props . to ) ) 
76-       this . updatePropsAsync ( props ) 
77-   } 
78- 
79-   updatePropsAsync ( props )  { 
80-     if  ( props . inject )  { 
78+     if  ( props . inject  &&  props . children  !==  this . props . children )  { 
8179      this . inject  =  props . inject ( this ,  props ) 
8280      if  ( this . inject )  return 
8381    } 
84-     this . updateProps ( props ) 
82+     if  ( props . reset  ||  shallowDiff ( props . to ,  this . props . to ) ) 
83+       this . updateProps ( props ) 
8584  } 
8685
8786  updateProps ( props ,  force  =  false ,  didInject  =  false )  { 
@@ -161,7 +160,7 @@ export default class Spring extends React.Component {
161160        this . animations [ name ] . stopped  =  true 
162161        if  ( this . getAnimations ( ) . every ( a  =>  a . stopped ) )  { 
163162          const  current  =  {  ...this . props . from ,  ...this . props . to  } 
164-           if  ( onRest )  onRest ( current ) 
163+           if  ( onRest   &&   ! this . mounting )  onRest ( current ) 
165164          cb  &&  typeof  cb  ===  'function'  &&  cb ( current ) 
166165
167166          if  ( didInject )  { 
@@ -200,8 +199,6 @@ export default class Spring extends React.Component {
200199  } 
201200
202201  start ( )  { 
203-     const  {  onStart }  =  this . props 
204- 
205202    let  fn  =  ( )  => 
206203      this . getAnimations ( ) . forEach ( animation  =>  animation . start ( resolve ) ) 
207204    let  resolve , 
@@ -211,7 +208,7 @@ export default class Spring extends React.Component {
211208      return  ( this . timeout  =  setTimeout ( ( )  =>  fn ( ) ,  this . props . delay ) ) 
212209    } 
213210
214-     if  ( onStart )  onStart ( ) 
211+     if  ( this . props . onStart )  this . props . onStart ( ) 
215212
216213    fn ( ) 
217214    return  promise 
@@ -288,6 +285,7 @@ export default class Spring extends React.Component {
288285  componentDidMount ( )  { 
289286    this . updateToken  =  false 
290287    this . start ( ) 
288+     this . mounting  =  false 
291289  } 
292290
293291  renderChildren ( props ,  componentProps )  { 
0 commit comments