OpenJSCAD.org icon indicating copy to clipboard operation
OpenJSCAD.org copied to clipboard

auto reload not working after loading a project

Open crysislinux opened this issue 5 years ago • 9 comments

Expected Behavior

auto-reload should work

Actual Behavior

it throws error:

Uncaught (in promise) Error: Failed to load file: demo/index.js [NotReadableError: The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.]

I couldn't find any settings in chrome to workaround the issue.

Steps to Reproduce the Problem

  1. set up a project with index.js in a folder
  2. open v2 site: www.jscad.xyz and load the project
  3. check Enable auto-reload

change some parameters in index.js to trigger a change. model does not update in the browser and the errors are in the console.

Specifications

  • Version: v2 www.jscad.xyz
  • Platform: mac chrome Version 86.0.4240.75 (Official Build) (x86_64)
  • Environment: browser

crysislinux avatar Oct 10 '20 06:10 crysislinux

@crysislinux thanks for this information.

sadly, this is one of those area where the browsers differ in implementation. can you answer a few questions for us?

  • Did you use drag-n-drop to load a project, or select a directory using load a project?
  • Did the error appear immediately? Or after a few changes?
  • Did the WEB UI stop functioning after the error appeared?

z3dev avatar Oct 11 '20 04:10 z3dev

Seems to be the standard... Files cannot be re-read if loaded from the file chooser.

CHROME - Drag-and-drop (OK), File Chooser (Exception, NotReadableError) FIREFOX - Drap-and-drop (OK), File Chooser (Exception, NotReadableError) SAFARI - Drag-and-drop (OK), File Chooser (Exception, WebKitResourceError) EDGE - Drap-and-drop (OK), File Chooser (Exception, NotReadableError)

z3dev avatar Oct 11 '20 08:10 z3dev

@z3dev

Did you use drag-n-drop to load a project, or select a directory using load a project?

load a project button

Did the error appear immediately? Or after a few changes?

Not work at all on Chrome, sometimes work on Firefox, but mostly not working too.

Did the WEB UI stop functioning after the error appeared?

It just doesn't update on changes, but buttons still work and can load the project again.

To solve the issue, I learned the web package code and implemented a new loader with WebSocket. Now I can create my project with webpack + typescript. it's event-driven and works smoothly, I can load the projects from my localhost or remote workspace(github codespace etc.).

I can make a PR after finalizing it(add retry logic, error handling etc.) if you think it's useful for others.

crysislinux avatar Oct 11 '20 12:10 crysislinux

To solve the issue, I learned the web package code and implemented a new loader with WebSocket. Now I can create my project with webpack + typescript. it's event-driven and works smoothly, I can load the projects from my localhost or remote workspace(github codespace etc.).

I can make a PR after finalizing it(add retry logic, error handling etc.) if you think it's useful for others.

@crysislinux this sounds interesting. A new pull request would be great. And we can give some feedback as to wether the changes can be integrated.

z3dev avatar Oct 11 '20 22:10 z3dev

Tried to create an extension for vscode. Seems promising.

2020-10-14 19-53-16 2020-10-14 19_55_03

crysislinux avatar Oct 14 '20 11:10 crysislinux

Tried to create an extension for vscode. Seems promising.

Cool. I’m sure there are lots of people looking for that extension. Be sure to publish it to the user group.

z3dev avatar Oct 14 '20 13:10 z3dev

@z3dev

Be sure to publish it to the user group.

Will do that. Seems like I put more time on tooling than actually building things šŸ˜…

crysislinux avatar Oct 14 '20 13:10 crysislinux

@z3dev

Be sure to publish it to the user group.

Will do that. Seems like I put more time on tooling than actually building things šŸ˜…

Same. šŸ˜” If you want something to do... there are plenty of open issues, and you are welcome to try to fix some of those.

z3dev avatar Oct 14 '20 22:10 z3dev

@z3dev

The extension was released šŸ˜„

https://marketplace.visualstudio.com/items?itemName=crysislinux.openjscad

I made a post in the user group: https://openjscad.nodebb.com/topic/178/an-vscode-extension-for-v2

crysislinux avatar Oct 15 '20 12:10 crysislinux