Skip to content

Commit

Permalink
Move component lifecycle methods up top
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Aug 3, 2017
1 parent f1f7f0b commit 2af85c8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions blocks/library/categories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ registerBlockType( 'core/categories', {
this.toggleShowHierarchy = this.toggleShowHierarchy.bind( this );
}

componentWillUnmount() {
if ( this.categoriesRequest.state() === 'pending' ) {
this.categoriesRequest.abort();
}
}

toggleDisplayAsDropdown() {
const { attributes, setAttributes } = this.props;
const { displayAsDropdown } = attributes;
Expand Down Expand Up @@ -236,12 +242,6 @@ registerBlockType( 'core/categories', {
</div>,
];
}

componentWillUnmount() {
if ( this.categoriesRequest.state() === 'pending' ) {
this.categoriesRequest.abort();
}
}
},

save() {
Expand Down

0 comments on commit 2af85c8

Please sign in to comment.