From c371409d26d3317a76312f235c50d4bf14128e6e Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Mon, 15 Oct 2018 15:39:00 +0530 Subject: [PATCH] ContentFileWrap: add comments --- src/components/ContentWrapFiles.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/ContentWrapFiles.jsx b/src/components/ContentWrapFiles.jsx index 67a06c3..8f310b0 100644 --- a/src/components/ContentWrapFiles.jsx +++ b/src/components/ContentWrapFiles.jsx @@ -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 &&