Skip to content

Commit

Permalink
Rename isMounted to avoid conflicts with React
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Sep 14, 2018
1 parent 065a008 commit 0b58955
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class ImportForm extends Component {
file: null,
};

this.isMounted = true;
this.isStillMounted = true;
this.onChangeFile = this.onChangeFile.bind( this );
this.onSubmit = this.onSubmit.bind( this );
}

componentWillUnmount() {
this.isMounted = false;
this.isStillMounted = false;
}

onChangeFile( event ) {
Expand All @@ -43,15 +43,15 @@ class ImportForm extends Component {
this.setState( { isLoading: true } );
importReusableBlock( file )
.then( ( reusableBlock ) => {
if ( ! this.isMounted ) {
if ( ! this.isStillMounted ) {
return;
}

this.setState( { isLoading: false } );
onUpload( reusableBlock );
} )
.catch( ( error ) => {
if ( ! this.isMounted ) {
if ( ! this.isStillMounted ) {
return;
}

Expand Down

0 comments on commit 0b58955

Please sign in to comment.