Shako Farhad 2020-08-20T06:59:39.005900Z

Hey guys. I have a question. If I want to dispatch an event as soon as there is a change to a specific value in my app-db, how should I do that? Can I dispatch events in reg-sub? Or do I put the dispatch in with the view like this: (do (dispatch event) [:div "hello"]) My backend is sending patch diffs of state through sse and I just merge them into my app-db. But certain keys in my db need to trigger an event. Any suggestions? :x

Lu 2020-08-20T09:16:39.009200Z

Never dispatch in reg-sub or in the rendering function. What I would do is to check if the diffs contain the key that should trigger the event, and if so, you can dispatch from your event-fx like so:

{:db diffed-db
 :dispatch (when (:trigger diffed-db)

p-himik 2020-08-20T09:23:05.010Z

@shakof91 There's re-frame.core/on-changes interceptor that does what you want. Combined with somewhat recently introduced global interceptors, this should cover your need.

Shako Farhad 2020-08-20T09:24:02.010400Z

Thanks for the feedback guys. I appreciate it ๐Ÿ™‚

Ramon Rios 2020-08-20T10:36:15.011600Z

Folks, have you tried to dockerize a re-frame app? I'm kinda lost if a need to treat as a usual npm app or do i need something different


For production, a re-frame app is going to end up being a .js file, plus some css files, etc.


It is just a client side framework. So you will need a way to "serve" these files. Perhaps you use a two stage Docker file which first builds the production artifacts (js, css, html, etc) and then copies them into a nginx image?


On the other hand, perhaps you are talking about dockerising the server side?


@ramonp.rios ^^

Ramon Rios 2020-08-20T10:41:54.017100Z

On my case, i already have my backend dockerized

Ramon Rios 2020-08-20T10:42:41.018Z

In my head, pretty easy, just get the jar and execute it. But i never did something with .js files i and was looking at it now

Ramon Rios 2020-08-20T10:42:48.018300Z

Thanks for the tips @mikethompson


If you use the re-frame-template to create an application ... ... you can use the lein release command (see the README) which will build the production artifacts (in /resources)


@ramonp.rios ^^


You then need to get them into a Docker image which will serve them

subsaharancoder 2020-08-20T21:07:56.021500Z

had a look at it, tried running the sample locally and it failed..went back to the re-frame+bidi+pushy setup and worked out the bug ๐Ÿ™‚

jmckitrick 2020-08-20T21:21:04.021900Z

Whatโ€™s the latest re-frame modal library these days?

jmckitrick 2020-08-20T21:23:13.022300Z

I see re-frame-modal but itโ€™s a few years old.

jmckitrick 2020-08-20T21:23:20.022500Z

Unless that means itโ€™s tried and true.


@jmckitrick You don't need anything re-frame specific. You just need a Reagent component. Perhaps look at re-com or google for "Reagent Material UI" etc.