This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-20
Channels
- # beginners (17)
- # boot (19)
- # chestnut (1)
- # cider (25)
- # clara (1)
- # cljs-dev (15)
- # cljsrn (10)
- # clojars (9)
- # clojure (182)
- # clojure-brasil (27)
- # clojure-dusseldorf (2)
- # clojure-gamedev (5)
- # clojure-germany (1)
- # clojure-greece (2)
- # clojure-italy (18)
- # clojure-poland (5)
- # clojure-romania (3)
- # clojure-russia (29)
- # clojure-serbia (6)
- # clojure-spec (9)
- # clojure-uk (77)
- # clojure-ukraine (1)
- # clojurescript (61)
- # cursive (5)
- # datomic (20)
- # defnpodcast (1)
- # emacs (10)
- # fulcro (2)
- # graphql (2)
- # hoplon (11)
- # lumo (4)
- # off-topic (50)
- # om (3)
- # onyx (26)
- # other-languages (39)
- # parinfer (2)
- # pedestal (5)
- # re-frame (32)
- # reagent (48)
- # rum (7)
- # shadow-cljs (10)
- # spacemacs (29)
- # sql (10)
- # unrepl (58)
- # vim (3)
@scknkkrer not fetch
, but this is closest thing I know
https://github.com/Day8/re-frame-http-fx
Actually, I am writing a library. A wrapper for Fetch API. But I don’t know will you guys use it or won’t. @mikethompson
We currently use re-frame-http-fx
, and unlikely to move in a hurry. But if you want to wrap fetch
then re-frame-http-fx
might act as a good tutorial/template.
Yeah. I am so newbie. But this is a good step for me. It’s proud to make something for my comunity. @mikethompson 😇
Quick question: when I create a component in this way (from the readme):
(defn clock
[]
[:div.example-clock
{:style {:color @(rf/subscribe [:time-color])}}
(-> @(rf/subscribe [:time])
.toTimeString
(clojure.string/split " ")
first)])
Will this re-create the subscription on each rendering of the component? I imagine subscriptions use some kind of listener mechanism, and I don't want to be taxing the GC too much unnecessarily.How does the above differ from creating the subscription in a top-level let
block, and then returning a higher-order function?
@cjsauer subscriptions are cached and de-duplicated. So, yes, the subscription is recreated each time the component rerenders, except, no, it isn't actually recreated because it is found in the cache and simply reused.
Hi, I found the keys used in reg-event-db
and reg-sub
and so on becomes strings after google compiler's advanced-mode so the events takes so much space in the compiled javascript files. Is it possible to make the keys used in reg-event-db
and reg-sub
be replaced by google compiler?
like this: var Jj=new M(null,"annc-toggle-display-type","annc-toggle-display-type",-302319952)
:annc-toggle-display-type
is one of the keys I used in re-frame
's handlers or subscribers.
@cmal you are using keyword ids, right (when using reg-event-db
, etc)?
If so, keywords take up next to no space.
Hi, what is the best bootstrap + re-frame solution like re-com, just responsible? Maybe somebody saw a good solution
Have you tried just using the cljsjs/react-bootstrap
?
For the most part I’ve had no problems using that
Just have to do reagent.core/adapt-react-class
on the things you want to use to use them as any other Reagent-style component
@mikethompson - I just looked at the compilation results of one of my projects and I see what @cmal means. A keywords that is used only as an event or sub name results in the string of its name being retained in the optimized output. (Unlike, e.g., functions that get obfuscated down to nearly nothing). In a re-frame app with many subs and events, these strings might add up to some substantial amount of space.
Hi, if anyone uses Emacs and would like to be able to jump to the definition of a re-frame registration from its use, I wrote a little elisp to help. Feedback welcome, I wrote it today but it's been working wonderfully for me so far! https://github.com/oliyh/re-jump.el
Hi, @mikethompson. Thank you for your response. I does not quite catch you. Are you asking how I define a event handler? I write codes like this:
(reg-event-fx
:annc-toggle-display-type
(fn [{:keys [db]} [_ t]]
{:db (let [t (if (= :stock (get-in db [:annc :display-type]))
:date
:stock)]
(-> db
(assoc-in [:annc :display-type] t)))
:dispatch [:loader-set-show false]}))
And I found something like var Jj=new M(null,"annc-toggle-display-type","annc-toggle-display-type",-302319952)
in the advanced compiled code.
I am not sure how the compiler will deal with these keywords, but I thought those keyword could be replaced by shorter ones to save space. But they are not.
@cmal when you say it takes up a lot of space, what kind of numbers are we talking about?