Fork me on GitHub
#reagent
<
2015-08-27
>
paulspencerwilliams20:08:11

I’ve just started learning cljs / reagent and have hacked a simple app together, but don’t think I understand how reset! atoms ripple changes to referencing components. I have some code at https://gist.github.com/paulspencerwilliams/0b9a9d00869ec9107d4a but when the button.onclick event triggers, it reset!s the atom, changing data, but the Highchart isn’t updated. Am I right in thinking this should affect the chart? Is it how I’m binding to chart-config in home-did-mount?

gadfly36120:08:52

Forgive me, I dont have time to take a close look at this, but consider using swap! Instead of reset! And :component-did-update instead of :component-did-mount

paulspencerwilliams20:08:45

@gadfly361 cheers for advise, had tried the more typical swap which hadn't worked but :component-did-update sounds like a good solution. Thank you.

paulspencerwilliams20:08:57

Also, I knocked the code together quickly to play; I should have refactured before posting to make and if easier to read.

gadfly36121:08:50

(swap! chart-config assoc :series [{:name "what" :data [1 2 3]}])

gadfly36121:08:46

Btw, post is fine, im just time constrained and can't sneak away from work long enough to read it haha