1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-05-07 11:05:18 +02:00

ContentFileWrap: add comments

This commit is contained in:
Kushagra Gour 2018-10-15 15:39:00 +05:30
parent 41ae269d9b
commit c371409d26

View File

@ -51,6 +51,7 @@ export default class ContentWrapFiles extends Component {
);
}
componentWillUpdate(nextProps) {
// If we get a new Item, clear file buffers and currently selected file.
if (
this.props.currentItem.createdOn !== nextProps.currentItem.createdOn ||
this.props.currentItem.id !== nextProps.currentItem.id
@ -59,6 +60,8 @@ export default class ContentWrapFiles extends Component {
this.state.selectedFile = null;
}
// If the files have changed and we have a selected file (even after previous condition),
// update the buffer with new file content (may be it got prettified?)
if (
nextProps.currentItem.files !== this.props.currentItem.files &&
this.state.selectedFile &&