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

contentwrapfiles: handle case of selectedfile getting deleted

This commit is contained in:
Kushagra Gour
2019-03-13 16:46:43 +05:30
parent f2f9b40246
commit 4a31a681d6

View File

@@ -83,6 +83,17 @@ export default class ContentWrapFiles extends Component {
this.state.selectedFile = null;
}
// If selectedFile got deleted
if (
this.state.selectedFile &&
!getFileFromPath(
nextProps.currentItem.files,
this.state.selectedFile.path
).file
) {
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 (