Coder Social home page Coder Social logo

Update D3-Graphviz about graphviz-react HOT 8 OPEN

domparfitt avatar domparfitt commented on May 4, 2024 2
Update D3-Graphviz

from graphviz-react.

Comments (8)

bigbug avatar bigbug commented on May 4, 2024

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

from graphviz-react.

DomParfitt avatar DomParfitt commented on May 4, 2024

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.

from graphviz-react.

bigbug avatar bigbug commented on May 4, 2024

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

from graphviz-react.

DomParfitt avatar DomParfitt commented on May 4, 2024

@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.

from graphviz-react.

dustinlacewell avatar dustinlacewell commented on May 4, 2024

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

from graphviz-react.

DomParfitt avatar DomParfitt commented on May 4, 2024

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.

from graphviz-react.

dustinlacewell avatar dustinlacewell commented on May 4, 2024

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 :(

from graphviz-react.

Vithanco avatar Vithanco commented on May 4, 2024

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!

from graphviz-react.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.