p5.js-web-editor
p5.js-web-editor copied to clipboard
Deleting index.html causes error when running sketch
Nature of issue?
Found a bug
Details about the bug:
- Web browser and version: All
- Operating System: All
- Steps to reproduce this bug:
- Create a new sketch
- Open the file browser sidebar
- Open the menu for
index.html - Delete the file
- Press the play button to run the sketch
The page goes blank with a JS console error this.props.htmlFile is undefined.
I think this happens becuase a sketch must have a single html file.
I guess the editor should not allow the HTML file to be deleted?
thanks for reporting! i think not allowing the HTML file to be deleted is a good solution. the web editor also assumes the file is named "index.html" which is also perhaps a brittle solution. besides, if there's no HTML, what's supposed to render?
I think renaming the HTML file works because the editor looks for any HTML file in the sketch, which is good.
I think renaming the HTML file works because the editor looks for any HTML file in the sketch, which is good.
okay cool, good to know!
I wish I could work on this, what could be the possible solution
i think there are potentially a few different solutions and it would be helpful to list them out!
It is possible to show an error in the preview indicating that there is no .html file
example

#1212 is a duplicate issue.
This issue is still not fixed,@catarak what are your thoughts on this one, like should we drop the delete option from the index.html file this will require providing a special prop to the sidebar that will help in removing that delete option.
According to me, As we are not allowing to add file with .html extension so we should not let the user to delete it. I would like to work on this issue @catarak @andrewn Should I hide the delete option for the .html file will be fine for this issue?