-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webworker bundling issue prevents proper rendering in dev mode #79
Comments
Hey @eacaps, thanks for checking out the lib! Regarding the worker, I agree, it definitely adds a bit of confusion upon configuration. So, in order for it to work, your framework (in this case Vue) should create a final build where the Orb worker is not bundled up together with the app code, but bundled as a separate script. For example, when integrating Orb to Angular app, you need to have this in the
What it will do is take the built worker script and bundle it along with the application. Then, when Orb wants to get a worker script, it will be there. Can you do the same? Feature requestsActually, you stumbled upon the vision of the Orb, which is to create such API where each of the underlying components can be changed. Orb is still in the early stage (thus the reason why 1.0.0 is not yet merged to the main) and what we want is to have all the Orb pipeline components (currently it is Graph (data), Style (integrated into graph), Renderer and Simulator) changeable. For now, Renderer is Canvas based, but we want to be able to provide support for WebGL support or even Canvas SVG support. For the Factory, I am curious to see if the build configuration will do the trick. Feel free to propose the change via PR of how you would like to be able to handle SimulatorFactory - you can even create an issue with the proposal before coding it up and we + collaborators can discuss it there. Thanks again for your interest. We should definitely add more items and missing pieces for version 1.0.0 to speed up the development and get to v1.0.0 quicker. |
Thank for the reply, I played around with it a bit, i think the equivalent in
but i couldn't quite get it working right. Using web workers from external packages in vite in dev mode is apparently a pain, so i'll revisit this later. My proposed fix would look something like this: (in src/views/default-view.ts)
this would add an optional and then in our vue code we have this:
|
Aha, I get it now. I thought it is a general Regarding the change, the proposal makes sense. Few notes for easier integration and better future proof:
Here in the future, we can add the renderer instance too. You, as a library user, can provide an instance of the simulator or even a callback that will create a simulator on its call. |
When running in dev mode using vite, it looks for process.worker in the vite deps folder:
Like I mentioned I tried including various files using the As for the other changes, I will take a look at the |
@eacaps Hey, I'm checking out Orb in my Vue 3 app and hitting the same issue as you. It renders fine in preview mode, but that's not really helpful when trying to quickly iterate in dev. Would you mind sharing your hack details to make it work in dev while the issue at large gets fixed? |
@lobo-tuerto I have created an example repo: https://github.com/eacaps/orb-hack. See the PR for more details. @tonilastre you can checkout the initial commit on that PR to see the error in the developer console. |
@eacaps Thanks man 🙏 |
Hi! Awesome work you all are doing here on a solid graph library. I've stumbled upon a few issues integrating this into a Vue 3.0 project where we are using the memgraph backend. We're using vite to build our application and when running in dev mode it does not handle the webworker bundling correctly from WebWorkerSimulator:
Unfortunately it fails in a way that is not caught by the SimulatorFactory, so it does not fall back to the MainThreadSimulator properly and the graph does not end up rendering properly. vite support for webworkers in dev mode is spotty at best, so i ended up just creating a by-pass so that SimullatorFactory would return a MainThreadSimulator in dev mode. I browsed around and found this related issue: #43 but that is running the
vite preview
command which works around the dev mode issues.Like I said, I've coded up a hack for now, but looking through the issues and Pull requests I was wondering what the best approach would be to resolve this issue. I was considering adding an optional SimulatorFactory in the options to provide library consumers with the ability to handle the Simulation creation if they'd like and I can submit an external Pull request from a fork, but I also see there is potentially a lot changing in Release 1.0.0. Is this still being considered as a release or what are your thoughts on outside contributions?
The text was updated successfully, but these errors were encountered: