p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

Deleting index.html causes error when running sketch

Open andrewn opened this issue 6 years ago • 9 comments

Nature of issue?

Found a bug

Details about the bug:

  • Web browser and version: All
  • Operating System: All
  • Steps to reproduce this bug:
  1. Create a new sketch
  2. Open the file browser sidebar
  3. Open the menu for index.html
  4. Delete the file
  5. 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?

andrewn avatar May 10 '19 18:05 andrewn

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?

catarak avatar May 10 '19 18:05 catarak

I think renaming the HTML file works because the editor looks for any HTML file in the sketch, which is good.

andrewn avatar May 10 '19 18:05 andrewn

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!

catarak avatar May 10 '19 19:05 catarak

I wish I could work on this, what could be the possible solution

davidbmx avatar Sep 10 '19 22:09 davidbmx

i think there are potentially a few different solutions and it would be helpful to list them out!

catarak avatar Sep 10 '19 22:09 catarak

It is possible to show an error in the preview indicating that there is no .html file example Captura de Pantalla 2019-09-10 a la(s) 17 27 16

davidbmx avatar Sep 10 '19 22:09 davidbmx

#1212 is a duplicate issue.

catarak avatar Nov 25 '19 22:11 catarak

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.

ashu8912 avatar Jan 26 '20 11:01 ashu8912

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?

shakti97 avatar Mar 04 '20 18:03 shakti97