* 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 becuase the comparison between arrays always return false. * Move all the code inside the file changing detector condition Co-authored-by: Mario de Frutos <mario@defrutos.org>
This commit is contained in:
parent
9f578461e4
commit
9434acd79a
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