This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-20
Channels
- # announcements (16)
- # babashka (71)
- # beginners (121)
- # bristol-clojurians (2)
- # calva (55)
- # clj-kondo (16)
- # clojure (103)
- # clojure-europe (9)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-spec (49)
- # clojure-uk (57)
- # clojurescript (28)
- # conjure (9)
- # cursive (6)
- # datascript (3)
- # datomic (35)
- # duct (20)
- # events (3)
- # figwheel-main (12)
- # fulcro (6)
- # graalvm (12)
- # juxt (3)
- # kaocha (5)
- # lumo (10)
- # malli (5)
- # off-topic (54)
- # pathom (8)
- # re-frame (19)
- # reitit (21)
- # remote-jobs (1)
- # shadow-cljs (102)
- # sql (38)
- # tools-deps (60)
- # uncomplicate (3)
- # xtdb (10)
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
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)
[:event-to-dispatch])}
@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.
Thanks for the feedback guys. I appreciate it 🙂
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?
On my case, i already have my backend dockerized
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
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
)
You then need to get them into a Docker image which will serve them
What’s the latest re-frame modal library these days?
I see re-frame-modal
but it’s a few years old.
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.