Fork me on GitHub
#clojurescript
<
2020-11-28
>
Carlo00:11:46

I'm learning reagent, and I have a doubt: I want to slowly construct a graph during the lifetime of the application, and the graph will be displayed with cytoscape.js. What should go in a r/atom? How can I get the external javascript to change the page?

Carlo03:11:59

I have two questions on reagent; the context is that my page displays a graph managed with cytoscape.js 1. I have the entire graph in my r/atom. However, when the graph is updated, I don't want to redraw all the graph (because to keep positions of the already displayed nodes I want to pass only those to cytoscape). Instead, I want to calculate the diff between what was previously in the atom and my new version, and use that diff to issue the proper command to cytoscape. I cannot figure where to put this logic in the reagent framework, though

Carlo03:11:14

2. I want to intercept when a node in my graph is clicked, and put that information in my global atom. But that part of the dom is built by cytoscape. How can I intercept the click events on the nodes?

p-himik03:11:06

All these questions should probably be asked in #reagent instead.

Carlo03:11:45

Thanks, will ask there!

Carlo17:11:39

Why can I use this in a template:

[:p #{{:id 1 :data "foo"}}]
but not this:
[:p {:foo #{{:id 1 :data "foo"}}}]
It has something to do with the way data is represented in the js side, but I'd like to understand better

Carlo17:11:36

sometimes an object is printed as #object[Core [object Object]] even if I use str

Carlo17:11:33

Nevermind my bad, I had a bad type assignment (I need instrumentation 😂)

jmckitrick21:11:59

I’m using .-rep to view a LocalDate in transit, but I need to format the result differently. What’s a good way to do that?

jmckitrick21:11:10

First time working with transit, BTW.