Fix infinite loop retrieving post files (#4192)
* Fix infinite loop retrieving post files Right now if all the attachments of a post are removed the component update code enters into an infinite loop because the comparison between arrays always return false.
This commit is contained in:
parent
9a97f91735
commit
3de2b29570
1 changed files with 1 additions and 3 deletions
|
|
@ -69,13 +69,11 @@ export default class FileAttachmentList extends PureComponent {
|
|||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (prevProps.files !== this.props.files) {
|
||||
if (prevProps.files.length !== this.props.files.length) {
|
||||
this.filesForGallery = this.getFilesForGallery(this.props);
|
||||
this.buildGalleryFiles().then((results) => {
|
||||
this.galleryFiles = results;
|
||||
});
|
||||
}
|
||||
if (this.props.files !== prevProps.files && this.props.files.length === 0) {
|
||||
this.loadFilesForPost();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue