This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Hey all! I'm working on my first app in reagent and think my understanding of async logic is a bit flawed. I'm calling a graphing function at https://github.com/kovasap/reddit-tree/blob/main/src/reddit_tree/core.cljs#L215 that should display svg in my app. However, my
reddit-comment-graph atom is not being updated before this call occurs, so no graph is displayed. To my surprise, the atom IS updated in https://github.com/kovasap/reddit-tree/blob/main/src/reddit_tree/core.cljs#L214, just one line above, and the data is properly being printed as HTML. Any ideas why this is happening and how I can get my graphing function to be called after my atom is updated just like the raw HTML?
Can you try changing from
My theory is that because it’s a function and not a component, it doesn’t listen for state changes on reddit-comment-graph
Changing it to a component instead should cause
viz to handle watching for state changes itself
thanks for the idea! that doesn't seem to help unfortunately : (. i get the same result with ( and [.
fwiw, in the end my graphing function returns a rid3/viz component https://github.com/gadfly361/rid3#viz-component
i wonder if maybe the way it's set up hardcodes everything on the first call and doesn't update properly?
actually, my code was throwing an error earlier that made it so the update never happened
(i was initializing my reddit-comment-graph atom without the fields that rt-g/viz expected, leading to a crash on the first call before the atom was populated with real data)