lombardpress / lombardpress-webjs

0 stars 3 forks source link

update all UNSAFE lifecycle methods #9

Closed jeffreycwitt closed 2 years ago

jeffreycwitt commented 4 years ago

update all UNSAFE lifecycle methods

jeffreycwitt commented 4 years ago

It seems that most cases could be solved by switching to componentDidUpdate For example
from this:

  UNSAFE_componentWillReceiveProps(newProps){
      if (newProps.transcriptionid !== this.props.transcriptionid){
         this.setState({versions: []}, () => {
           this.getVersionHistory(newProps.transcriptionid)
         })
       }
   }

to this

  componentDidUpdate(prevProps, prevState){
    if (this.props.transcriptionid !== prevProps.transcriptionid){
      console.log('running fetch')
      this.setState({versions: []}, () => {
        this.getVersionHistory(this.props.transcriptionid)
      })
    }
jeffreycwitt commented 4 years ago

Basically done. Couple of instances lingering in used components

jeffreycwitt commented 2 years ago

done I think.