This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-17
Channels
- # alda (5)
- # bangalore-clj (1)
- # beginners (9)
- # bigdata (1)
- # boot (51)
- # carry (1)
- # cider (9)
- # cljs-dev (22)
- # clojars (39)
- # clojure (118)
- # clojure-brasil (1)
- # clojure-czech (8)
- # clojure-france (2)
- # clojure-italy (5)
- # clojure-korea (9)
- # clojure-russia (9)
- # clojure-spec (17)
- # clojure-uk (42)
- # clojurescript (48)
- # core-async (1)
- # emacs (3)
- # figwheel (1)
- # funcool (3)
- # hoplon (39)
- # klipse (51)
- # lein-figwheel (4)
- # leiningen (2)
- # luminus (5)
- # off-topic (245)
- # om (18)
- # onyx (19)
- # parinfer (1)
- # pedestal (18)
- # re-frame (47)
- # reagent (19)
- # ring-swagger (1)
- # specter (18)
- # untangled (93)
- # vim (8)
- # yada (56)
Finally got around to publishing https://github.com/SMX-LTD/re-frame-cookie-fx#cookies-effects-handler-for-re-frame, a cookies fx handler for re-frame. Any feedback welcome 🙂
Fx handler for injecting stylesheets: https://github.com/SMX-LTD/re-frame-style-fx
@superstructor: Great, thanks for publishing those - I’ll take a look tomorrow. If you want to add them to the external resources docs page that would be great, if not I can do it later. Awesome that you’re using the google closure library, it would be great if eventually we have an fx handler for all of the useful parts of it so new users (and me) don’t have to think about how to use them with re-frame.
New version of re-com. We called it v1.0.0 It has one annoying backwards-incompatible change (sorry): https://github.com/Day8/re-com/releases
@mikethompson thanks for the heads up about this chan 🙂
I know this has been answered before but I am not really happy with the answer (use functions that operate on db). What I would like is to use values of subscriptions as input to a handler. Previously this was easily achieved by having each subscription just refer to a function that operated on db and then reuse that function in the handler (the previously suggested answer). In 0.8.0 this no longer works well since the input to most subscriptions is no longer db but other subscriptions. A ”leaf subscription” that depends on other subscriptions is therefore not trivially calculated from the value of db. Therefore what I am doing currently is to subscribe to the subscriptions I need in the handler and then pass them when I fire the event. But this is not very clean since the component that contains the dispatcher does not actually depend on those subs apart from when firing the event. How are you guys solving this? Is there a clean way of doing it or could it be implemented in re-frame.core?
One way of solving it would be to have a function that took a subscription vector but did not return a subscription but just a dereferenced value directly. Not exactly pure but could be quite useful if used carefully?
i need to implement a simple counter without using re-rendering any component which using it, how can i do that ?
@lxsameer I don't understand the question. Are you saying you just need to store a numeric value somewhere?
@vikeri: can you not do the same as pre-0.8 and just use reg-sub-raw
instead of reg-sub
?
@shaun-mahood Yes I could, the new concept of subscriptions depending on other subscriptions have significantly improved a lot of things though so that is not really an option for me.
Curious, what does "subscriptions depending on other subscriptions" mean? I haven't used 0.8.0
@vikeri: If you have some example code of what you have to do now and what you wish it would do, or something that could help me more easily understand what you want to do, I'm happy to take a look and see if I can come up with any ideas. No guarantees though 🙂
@kauko https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs#L22-L49
@shaun-mahood Lets say I wan’t to get the value of the subscription :footer-counts
here: https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs#L143
That function does not have app-db
as input but instead [todos completed]
so to get the value of :footer-counts
I would first have to calculate :todos
and :completed-count
individually. While this might be easy in this example it quickly turns cumbersome when the level of nesting grows.
@vikeri: Ok cool, I'll take a look later today and let you know if I can think of any ideas.
@shaun-mahood Thanks!
I mean, you can store any value in the db, you don't need to subscribe to it.. but then you won't see it in your UI. Are you sure you need something like that?
@andre: I've not been getting anything in my subs
section in re-frisk
, but it seems like everything else works fine. Is there anything additional I should do to get this working?
@andre: Nevermind, it looks like I just need to have that sub seen by a function defined using def-view
and it becomes visible. Although I think I found something else - it looks like the def-view
macro doesn't support comments the same way defn
does, I get an error if I just do a straight replacement.
Any ideas why (re-frame/subscribe [:name]) in here: https://gist.github.com/pupeno/4b37f11f2992747582165cbf790d6aaf#file-foo-cljs-L23 would throw "Cannot read property 'call' of undefined"
It’s the same code as in the template but all in one file.
Does it work if you change it to this?
(defn main-panel []
(let [name (re-frame/subscribe [:name])]
(fn [name]
[:div "Hello from " @name])))
@vikeri: Here's my best attempt at how I would solve your problem with passing db through subs https://gist.github.com/smahood/e5498ad569842f37d1313a68c17e1336
@shaun-mahood it doesn’t fix it.
@shaun-mahood that parameter would be required if the component had parameters, but it doesn’t: https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components#form-2--a-function-returning-a-function
It looks like like 64 of subs.cljc is having the problem. (handler-fn app-db query-v) is may be returning nil when it shouldn't
@pupeno: Worth a shot 🙂 I copy and pasted just that code into a file and it runs fine for me with no errors.
It is the lein template, so, it should be fine.
But when I’m running it inside an electron app, it doesn’t work.
Ok that makes more sense 🙂
It does?
Yeah, even though I have no reason for it, you're the 3rd person this week having problems with cljs in electron - no idea why but it seems to be a theme.
What are you doing different now from your isomorphic blog posts?
shaun-mahood you mean in general?
or regarding this error?
@pupeno: Mainly relating to the error - normally if someone had a problem with anything like this I'd point them to your blog posts. Though I'm also curious 🙂
Hahaha… I’m doing something completely different right now… just trying to get re-frame to play nicely inside electron.
I just noticed electron came with old libraries of many things, so, I upgrade them, but that wasn’t it. Funnily enough, I don’t have a backtrace now, although I have the same error.
Wish I could help, but I'm totally clueless. I look forward to the blog post when you figure it out though!