From 53241c91805d286a045c7e12f9176e06d4931c74 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Tue, 8 Oct 2019 16:36:38 -0400 Subject: [PATCH] fixes #1180 --- client/components/Nav.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/components/Nav.jsx b/client/components/Nav.jsx index f00a26cb..ca80c4bd 100644 --- a/client/components/Nav.jsx +++ b/client/components/Nav.jsx @@ -129,12 +129,12 @@ class Nav extends React.PureComponent { } handleAddFile() { - this.props.newFile(); + this.props.newFile(this.props.rootFile.id); this.setDropdown('none'); } handleAddFolder() { - this.props.newFolder(); + this.props.newFolder(this.props.rootFile.id); this.setDropdown('none'); } @@ -662,7 +662,8 @@ Nav.propTypes = { stopSketch: PropTypes.func.isRequired, setAllAccessibleOutput: PropTypes.func.isRequired, newFile: PropTypes.func.isRequired, - newFolder: PropTypes.func.isRequired + newFolder: PropTypes.func.isRequired, + rootFile: PropTypes.func.isRequired }; Nav.defaultProps = { @@ -677,7 +678,8 @@ function mapStateToProps(state) { return { project: state.project, user: state.user, - unsavedChanges: state.ide.unsavedChanges + unsavedChanges: state.ide.unsavedChanges, + rootFile: state.files.filter(file => file.name === 'root')[0] }; }