This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-27
Channels
- # ai (4)
- # beginners (102)
- # boot (216)
- # cider (20)
- # cljs-dev (9)
- # clojure (130)
- # clojure-russia (4)
- # clojure-spec (9)
- # clojure-uk (11)
- # clojurescript (59)
- # core-async (2)
- # cursive (10)
- # datomic (51)
- # figwheel (1)
- # flambo (3)
- # hoplon (2)
- # luminus (1)
- # om (17)
- # om-next (4)
- # onyx (2)
- # perun (2)
- # re-frame (79)
- # ring (5)
- # ring-swagger (9)
- # rum (3)
- # schema (3)
- # specter (9)
- # untangled (3)
- # vim (1)
Ok I get this part now, so the whole reason for -fx handlers is to keep event (effect) handling function pure and somehow by some magic, I am given the stuff that I need from the outside world in the cofx map.
So before my handler is ran, re-frame needs to fetch the coeffects that I am interested in, so I need to tell re-frame which are this coeffects, right ?
@gadfly361 @geoffs @mikethompson Thanks guys. I’ll think about it.
@smnplk sounds like you are on the right track
I cant figure out what the signature for a reg-sub-raw
Layer 3 intermediate-node should look like;
would it be something like
(reg-sub-raw (register-handler ...) (register-handler ...))
?@owen usage:
(reg-sub-raw
:an-id
some-fn)
So it is like most of the registrations in that way.
The raw
bit refers to the low level nature of some-fn
.
(defn some-fn
[app-db event] ;; app-db is a r/atom not a value
.... returns a reaction ...)
@mikethompson right, but with the intermdiate subscriptions
yep, see above
Reading list ...
To understand reactions and r/atom interplay:
https://github.com/Day8/re-frame/blob/master/docs/SubscriptionFlow.md
The old README (the old name for reg-sub-raw
was register-sub
)
https://github.com/Day8/re-frame/blob/6f56b72fd0f72f1d744a0406256d753e0c9715b1/README.md#the-signal-graph
Example of use (including on-dispose
)
https://github.com/Day8/re-frame/blob/develop/docs/Subscribing-To-External-Data.md
its only because this would be an intermediate subscription that I'm not sure what the signature would look like
No, register-handler
is the old name for registering event handlers
Here. we are in the world of subscription handlers
Does this help: https://clojurians.slack.com/archives/re-frame/p1482864202002619
If you want to use :on-dispose
... then you are going to be doing somethng like this:
(reg-sub-raw
:some-id
(fn [app-db event]
...... return some reaction in here which has an :on-dispose)
Then that can be used like this (subscribe [:some-id])
Which is standard
right but unless I'm mistaken the some-fn is providing the first argument of app-db
which wouldnt work in intermidiate subscriptions
ala https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs#L82
(reg-sub-raw
:id:
(fn [query-v _]
[vector of subscriptions])
(fn [[subscriptions] _]
(make-reaction
:on-dispose)))
(reg-sub-raw
:some-id
(fn [app-db event]
(make-reaction
(fn []
use @app-db or @(subscribe [:some-other] ....)
:on-dispose (fn [] ...))))
In effect you just use subscribe [:stuff]
within the reaction
(being sure to put a @
on the front
So with reg-sub-raw
you do not define the input signals, like reg-sub
you just use straight subscriptions
within the returned reaction
being sure to put @
on the front <--- forgetting this is a trap for newbies everytime
ok I think the
> with reg-sub-raw
you do not define the input signals, like reg-sub
makes sense
Yes, always
Pretty much the same
no problem
@owen updated docs https://github.com/Day8/re-frame/blob/develop/docs/SubscriptionFlow.md#reg-sub-raw
yeah, that was the main reason why I’ve choosen reagent+re-frame over other projects: badass documentation.
My app is re-frame on client side. On server side, I need (1) persistence (kv store) and (2) passing messages between clients in real time. What server setup works nicely with cljs/re-frame on client side?
I have no experience with couchdb, but I would look into it for something like this @qqq
rethinkdb, the commercial entity has closed, but it is likely that rethinkdb the OSS entity will continue on in some form (exact form unknown).
@qqq have you considered firebase?
I seem to remember the clojurescript library is called matchbox
@mikethompson: would work well as I'm currently using GCP
I'd just like to use whatever fits nicely into the re-frame network, as I have complete power over what tech to use.
We used firebase and found it very quick to get going. The data model you get is very limited, and we eventually moved to rethinkdb (which we loved).
@mikethompson: are you using gcp, aws, digital ocean, or your own hosting; and is there a blog post on this somewhere?
rethinkdb was a lot more work
firebase is hosted
Which is part of the reason it is so easy to get going
For rethinkdb we used http://compose.io for hosting. Seems a bit too expensive, but we've never bothered to move away
I'm a little squeamish on using http://compose.io ; is there a way to get aws aurora or aws rds to provide the 'real time streaming' part?
Also, the mighty @yogthos has detailed how to do this with PostgreSQL: https://yogthos.net/posts/2016-11-05-LuminusPostgresNotifications.html
@mikethompson : that's what I want! notifications on DB modifications; thanks!
@frank @owen I changed the placement of those new reg-sub-raw
docs to:
https://github.com/Day8/re-frame/blob/develop/docs/SubscriptionFlow.md#reg-sub-raw