This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-23
Channels
- # alda (1)
- # beginners (26)
- # boot (88)
- # carry (2)
- # cider (6)
- # clara (6)
- # cljs-dev (43)
- # cljsrn (14)
- # clojure (48)
- # clojure-belgium (2)
- # clojure-czech (4)
- # clojure-dev (1)
- # clojure-dusseldorf (7)
- # clojure-japan (1)
- # clojure-russia (55)
- # clojure-spec (65)
- # clojure-taiwan (1)
- # clojure-uk (28)
- # clojurescript (154)
- # cursive (5)
- # datomic (1)
- # editors (2)
- # emacs (29)
- # funcool (1)
- # jobs (3)
- # lambdaisland (5)
- # leiningen (1)
- # luminus (2)
- # new-channels (1)
- # off-topic (17)
- # om (18)
- # om-next (10)
- # onyx (24)
- # parinfer (14)
- # pedestal (4)
- # planck (3)
- # re-frame (69)
- # reactive (2)
- # reagent (3)
- # schema (2)
- # spacemacs (2)
- # sql (13)
- # vim (11)
@danielcompton in case these 3 calls happen inside the handler with go block, would it block all other events processing?
don’t quite understand your question, but in any possible scenario: no, anything happening inside a go block will happen asynchronously and can’t block events from processing
The only way to block events from being processed is by doing CPU heavy work which will block the thread
@stuartmitchell hi guys. sorry for the delay, @mikethompson mentioned that it would be good to show data for components wich are rendering now, so, I was working on this, and I had to integrate in the component lifecycle, so i decided this shouldn't be in the production code, so i implemented compiler option for the re-frisk, to not generate any code in the production, last thing i wanted to do was draggable and resizable window with the data, and here I'm stuck , reagent works strange with the two reagent/render calls in one project, i don't want to integrate re-frisk in the app, i want separate div for it
one more strange thing, if i'm using only :require-macros , it doesn't include my cljs files , so i have my macro in clj file, it calls my function in the same namespace in cljs file, and if i :require this macro, it WARNING: Use of undeclare var which in my cljs file. hm
I’m not sure if this is what you mean, but you have to use the fully qualified name to refer to functions in the cljs files from clj macros. For example my-project.utils
is a cljs function
(defmacro <?
[expr]
`(my-project.utils/throw-error (cljs.core.async/<! ~expr)))
@andre: Also, what did you use to make that gif?
so, i'm stuck with the macro, i've compiled jar for clojars, included it in my project. :require-macros my macros, and it doesn't work 😞 if i requere my lib by :requere it works, but i can't release this 😞
using
(:require [re-frisk.core :refer-macros [def-view]])
instead (:require-macros [re-frisk.core :refer [def-view]]))
works fine, hm@andre testing it soon! Looks super useful so far, thanks! :)
What is better: To have nested components with bound subscriptions by a let, like (let [my-react (subscribe ...))) or using subscribe only on the toplevel or something else?
@robewald: I prefer top level subscribes where I can, but it's really dependent on what you are trying to do and what makes sense for your application. I like to think about whether that component should be interchangeable, what parts of the app or app-db it should know about, if there are performancw concerns, etc. before deciding on which way to go. I often end up refactoring and changing my original decision though.
Hey all, anyone know of a ready-made re-frame effect that will dispatch another event after a timeout? Looking into implementing little status updates that close themselves after 5 seconds or whatnot
It doesn't seem hard to implement myself, was just wondering if it already existed somewhere
Hi, I have a situation where a leaf component inside an outer dynamic component (with :key
specified) is definitely being re-rendered when its r/reaction
input changes. It renders some hiccup corresponding to a button with the btn-text as its first argument. The txt is changing from one call to the next however the inner button is only being rendered with the original text.
The inner button is a Form-2 component (i.e., (defn a-comp [txt other stuff] (fn [] [blah blah]))
. That lambda is getting called and blah blah
is rendered with the original text but the setup in a-comp
does not run even though txt
is different from one run to the next (as verified by js/console.log
from the calling component).
I would imagine that =
comparison for two different text strings would produce a false and thus the component should be re-rendered (incl. its outer setup).
@johanatan: Can you post a minimal repro of what's happening? My first impression is that there's something wrong with the way you've declared one of the components, since that's pretty standard functionality, but if you can get some code for me to work with I'm happy to go into more depth with it.
The other possibility that seems likely to me is that there's some issue with how you are calling the inner component.
Sure, this feels very similar to the previous issues I hit around this functionality. I suppose it's time to bite the bullet and make a minimal repro.
I find every time I have to go that far in troubleshooting it exposes the problem for me. I never want to do it, though. 🙂
Yes, there have been many similar issues for me over the last few weeks that I've been able to resolve without going that far. This one has withstood a couple of hours of the typical onslaught of debugging techniques though so either a) there really is a framework issue here or b) this one is trickier than usual
@shaun-mahood I have a minimal repro.
Although one can see "left" printed to the console, the bkg color of the label does not change from white to transparent. See: https://gist.github.com/johanatan/b67236e3440fdcc0e9ffc78aaf1bdb0d#file-minimal_repro-cljs-L36
[This isn't the exact failure that I'm seeing in practice: but it is really close (and certainly within the same class of failures)]
@johanatan: great, I'll take a look and see if I can find anything useful
@johanatan: It looks to me like there's an issue with how you are setting the background-color - if I replace
:style {:background-color (if @hovered? "#ffffff" "rgb(0,0,0,0)")}
with :style {:background-color (my-color @hovered?)}
where my-color is defined with
(defn my-color [hovered?]
(if hovered?
"#ffffff"
"#000000"))
it seems to all workIf you can set it up using the lein new re-frame +re-com
template it will make it easier for me to test - I had to do some tweaking to your code to get it to run so I might have changed something that is giving you a problem.
That would work too 🙂
@johanatan: If you change your inner function to
(defn inner [label on-click]
(let [hovered? (reagent/atom false)]
(fn [label on-click]
[re-com/label :label label
:style {:background-color (if @hovered? "#ffffff" "rgba(0,0,0,0)")}
:attr {:on-mouse-over #(reset! hovered? true)
:on-mouse-leave #(do (js/console.log "left") (reset! hovered? false))
:on-click on-click}])))
then I think everything will work - when I fix it, then the on-click handler fires and the text changes to all caps. Explanation for why is at https://github.com/Day8/re-frame/wiki/Creating%20Reagent%20Components#form-2--a-function-returning-a-functionThat makes sense. I remember reading that but for some reason it didn't sink in lol
Yeah it's pretty important. It was a source of a lot of errors for me when I started with re-frame, and is still the first thing I check 🙂
Too bad my initial message: "The inner button is a Form-2 component (i.e., (defn a-comp [txt other stuff] (fn [] [blah blah]))
" wasn't enough to give it away
I thought that might be the case, but I don't like jumping to too many conclusions - way nicer to be able to work through the real problem instead of a bunch of wild guesses. Semi-related, if you haven't seen this talk it's one that I recommend any time I get a chance - https://www.youtube.com/watch?v=FihU5JxmnBg
I don't really consider that a wild guess as a) it is a commonly stumbled over detail b) my actual initial code example posted clearly exhibited the problem c) it is still scientific to say "here are a few common things to check" (and linking to that article)
It is more like an extremely informed and educated guess-- almost to the level of a deduction really given the code sample posted.
Oh, I had other wild guesses waiting in the wings for you if that one didn't work 🙂
Also, if you had made an attempt to understand what was meant by this: "That lambda is getting called and blah blah
is rendered with the original text but the setup in a-comp
does not run even though txt
is different from one run to the next (as verified by js/console.log
from the calling component)", you'd have seen that my expectations were not correct.
Yes, I had some ideas on how to progress and I also had some ideas about where your expectations might have been incorrect. I've also seen your previous questions and I decided based on those that I would rather try and help in a more substantial fashion so you could better understand how things are meant to work in the context of your code, as I find that it is a better way to communicate than simply referring you to the documentation. Hopefully you have a better understanding of things now.
Honestly an answer like "your inner lambda needs to recapture the component props for Form-2 components" would have been perfectly understandable and helpful to me.