Fork me on GitHub
#reagent
<
2022-09-02
>
James Pratt10:09:25

A beginner question. I am stumped as to why the DOM is not updating when I add to values in a collection in an atom. My code: https://github.com/jointprob/jointprob-shadow-cljs/blob/master/src/main/core.cljs#L32 See it in action on github pages: https://jointprob.github.io/jointprob-shadow-cljs/ In the console I can see that the samples atom is being updated but the DOM is not changed. Can someone see what I am overlooking?

✅ 1
p-himik10:09:49

Turn that [:div ...] into a proper component, within its own function.

James Pratt10:09:23

Oh! Thanks, will give that a go

juhoteperi10:09:23

Yes, rdom/render parameter is a bit special. Reagent can't register RAtom change listeners to any component in this case, so you need a component.

👍 1
James Pratt11:09:57

Thanks guys! That fixed my problem and the vega-lite components are updating beautifully too. :smiling_face_with_3_hearts:

👍 1
Ryan16:09:07

Hey all (esp @gadfly361), updated my deps to new versions and spending today tracking down new console warnings for non-reactive use of subscribe.. I think I’ve tracked down a bunch to re-pressed/impl.cljs .. is this something to worry about? I think the warning is more for using subscribe in js event handlers, but I just want to be double sure. Thanks!

gadfly36116:09:22

@rdonahue thanks for the heads up! re-pressed was written before re-frame put those warnings in. If you or anyone reading this thread is interested in submitting a PR to refactor, I would be happy to review.

👍 1
Ryan19:09:38

Another question.. working with a JS interop component (PrimeReact kit) and its SplitterPanel seems to want a rendered component.. I'm passing a fn that resolves a component but if I wrap with [:div (get-panel panel)] it returns arity 0 errors.. how do I render the [:div ...] ?

p-himik20:09:23

Can you provide the relevant CLJS code, an example JS code, and a full stack trace of that error?

Ryan20:09:08

I think I just got it sorted out, that particular part of the code was like some of the first 'working' cljs I ever wrote and its solidly in the 'I have no idea how it ever worked' category.. subscriptions all in wrong places, wrong component forms being used.. totally refactored it and its now behaving normally.