Skip to content
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

Update D3-Graphviz #28

Open
bigbug opened this issue Dec 14, 2020 · 8 comments
Open

Update D3-Graphviz #28

bigbug opened this issue Dec 14, 2020 · 8 comments

Comments

@bigbug
Copy link

bigbug commented Dec 14, 2020

D3-Graphviz has been updated to major release 3.
This lib should get there as well

@bigbug
Copy link
Author

bigbug commented Dec 14, 2020

I tried to upgrade d3-graphviz in this package, however the test now fails: it seems it doesn't render anything:
Screenshot 2020-12-14 at 16 02 34

Screenshot 2020-12-14 at 16 03 37

I also get a fault:
both async and sync fetching of the wasm failed

@DomParfitt
Copy link
Owner

Hi @bigbug,

The version bump of d3-graphviz to v3 is a major bump because it contains breaking changes from v2, which is why when you have tried to update it yourself you are getting failing tests and nothing being rendered.

I agree it would be nice to upgrade the dependency to v3 if possible. I had a short look when v3 was first released and could not come up with a satisfactory solution that didn't require WASM to be included manually in any page using the component. I will have another look at it when I get a chance to see if there's a way to upgrade without making breaking changes to this component but feel free to have a look yourself if you are interested.

Also, it's likely that any changes will require the test snapshots to be regenerated. Because this component provides a very slim wrapper over d3-graphviz there's not a lot to test (essentially all it does is provide an HTML element for d3-graphviz to attach its SVG to in a React flavoured way and handle updates being passed to d3-graphviz) so the tests just ensure that the component rendered the elements as expected.

@bigbug
Copy link
Author

bigbug commented Dec 14, 2020

Yeah, I thought this bump would be easy but then I got from one problem to another ... before this I also didn't know about wasm so ...
As you said the wasm file would have to be included in the build - so for CRA this would be /public/
What do you think about post install scripts?
https://stackoverflow.com/questions/34781630/how-to-automatically-copy-files-from-package-to-local-directory-via-postinstall

@DomParfitt
Copy link
Owner

@bigbug if you want to put together a proof of concept using post install I'd be happy to look at it.

I'm not sure without looking at it in detail whether it would work or not though. Presumably the post install would copy the WASM file but this would still need to be referenced in a script tag in the user's index file? The approach also needs to work for any React framework, not just CRA.

@dustinlacewell
Copy link

Here's to hoping someone finds a path forward one day.

@DomParfitt
Copy link
Owner

Here's to hoping someone finds a path forward one day.

@dustinlacewell please feel free to look for the path yourself if you are keen to see this done.

@dustinlacewell
Copy link

I was able to get graphviz-react working with latest d3-graphiz and nextjs by using webpack to copy the .wasm files to .next/static/chunks/pages/ which is where it was looking for them on import.

I guess it really isn't a solution for this library though, sorry :(

@Vithanco
Copy link

Vithanco commented Oct 4, 2022

d3-Graphviz reached now version 4.4.0. I run into trouble with the @types/d3-graphviz that I cannot handle myself. :-(
Would love to see that somebody with more than 1 months of Typescript experience looks into this. Thank you for consideration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants