Git Product home page Git Product logo

Comments (3)

gadfly361 avatar gadfly361 commented on June 11, 2024

@prook Thank you for opening up this discussion! I think that is a fantastic question.

I think ultimately it comes down to a matter of taste, and so the following is just my personal preference:

I agree with the recommendation by re-frame that using lifecycle hooks to load data is overloading the responsibility of the view layer.

So if your preference is to start and stop websocket via lifecycle hooks, to proceed with with wrapping rid3/viz in another component, even though I do agree it is a slight bodge. The reason for this is because I would prefer to limit the surface area of rid3 if possible and other (not-too-painful) solutions exist.

Anyways, just wanted to give my initial take on this topic, but I am happy to discuss it further.

from rid3.

prook avatar prook commented on June 11, 2024

True, data retrieval seems inappropriate in the view layer.

But what about something bound to the view more tightly? d3-force simulation, for instance. Lifecycle of js/d3.forceSimulation should be pretty much bound to rid3/viz's, and the sim should be invisible to the world outside the component as well. The simulation should initialize on component mount, update nodes/links/whatnot on rid3/viz's ratom change, and stop on component unmount. I think no matter what solution to d3-force sim I (we?) come up with, the finer lifecycle control may be needed.

I didn't mention d3-force initially to avoid digression, but now it seems unavoidable. Also, I thought finer lifecycle control could be good for other scenarios as well, but I fail to come up with examples (and if I do, they're easily dismantled) -- all lifecycle work not related to D3 (e. g., WebSockets) can be done outside rid3.1

But D3 stuff cries to be in rid3, doesn't it?

So the question is, are there any other parts of D3 toolbox that could use finer lifecycle control? Or will this boil down to finding how to implement d3-force properly in #10 (and the digression was this whole issue)?

1 And also it gave me -- well, gives me -- quite a headache to figure out a how to plug in the simulation. I've found a few solutions which do work, even with GUP and nodes properly merging in the sim object, but they are hairy to say the least.

from rid3.

gadfly361 avatar gadfly361 commented on June 11, 2024

@prook Thanks for following up!

I think you have convinced me that we should open up the api and add more lifecycle hooks to things like svg.

So if you are willing to cook up some patches for that, I'd be happy to review it!


Also, regarding force simulation specifically #10 , I haven't had time to look in to that. If you have a minimal, working example with rid3, it would be nice to see ... and then more to the point, we can brainstorm on what we can do to improve it!

from rid3.

Related Issues (11)

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.