Fork me on GitHub
#re-frame
<
2021-11-16
>
lilactown05:11:10

the re-frame way would be to dispatch an event which would return an effect map with the fx

lilactown05:11:31

an event does not have to update the app-db

p-himik12:11:15

I have left a comment in the issue. tl;dr: the initial assumption is incorrect - injecting a sub was never supposed to dispatch anythign.

Quentin Le Guennec12:11:26

@U2FRKM4TW Thanks for your answer but are you sure we're talking about the same thing? your answer doesn't make sense to me. In the issue I'm talking about track, not inject.

p-himik12:11:11

Oh shoot, you're right! I managed to get stuck at reading "track" as "inject", my bad. Probably because I've seen re-frame-utils being mentioned before only in the context of injecting sub values into event handlers.

Benjamin13:11:35

Is it customary to put all reg-fx in 1 file? The re-com lein template has events and subs files. Is there usually a effects file?

lispers-anonymous14:11:50

I don't. I put them in different files. For example, if I had some effects for downloading a document, i would have a namespace called document and an effect named ::download in that namespace. The namespaces and namespaced keywords give more meaning to the effects. Using a namespaced keyword in the ns effects seems pretty meaningless.

p-himik14:11:45

I wouldn't stick too hard to any such practices. If you feel that something belongs at some particular place, just put it there. But you have to make sure you understand the repercussions. With just one fx.cljs or whatever, you just have to include it once anywhere and forget about it. With multiple files - you have to include them all somewhere or include them on the need-to-know basis, but as mentioned above qualified keywords help with this. I myself like the latter approach - I also do the same with subscriptions and events.

Benjamin14:11:51

alright thanks

Daniel Craig21:11:26

Hi, I have a function that returns a SVGSVGElement - how can I add this to my re-frame app? I get the error Error: Objects are not valid as a React child (found: [object SVGSVGElement])

p-himik22:11:46

That's more a #reagent question. Create a form-3 component, attach a ref to e.g. a plain :div in its :reagent-render, and use that ref to add that SVG as its child in :component-did-mount.

Daniel Craig22:11:11

Thanks man

👍 1
ingesol23:11:07

Looking for feedback on a new library for integrating with clj-statecharts. Made a basic use case example in the readme, would be happy for any comments 🙂 https://github.com/ingesolvoll/re-statecharts

🎉 1
catjam 1
🙂 1