This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-11
Channels
- # admin-announcements (3)
- # beginners (51)
- # boot (14)
- # cider (55)
- # cljsrn (5)
- # clojure (105)
- # clojure-austin (2)
- # clojure-brasil (3)
- # clojure-dusseldorf (2)
- # clojure-greece (5)
- # clojure-italy (1)
- # clojure-mexico (1)
- # clojure-russia (74)
- # clojure-spec (66)
- # clojure-uk (22)
- # clojurescript (124)
- # cursive (10)
- # datomic (79)
- # events (2)
- # immutant (3)
- # jobs (4)
- # klipse (38)
- # leiningen (2)
- # luminus (1)
- # off-topic (25)
- # om (48)
- # om-next (36)
- # on (1)
- # onyx (19)
- # overtone (3)
- # pedestal (2)
- # proton (3)
- # re-frame (178)
- # reagent (49)
- # ring-swagger (1)
- # spacemacs (10)
- # specter (29)
- # testing (5)
- # untangled (6)
- # yada (65)
Does anyone run ClojureScript tests using cider?
@sandbags I just saw your message. free-form.core/form
is for forms that just use reagent while free-form.re-frame/form
is for when you are using re-frame. The difference is that core/form just calls a function and re-frame/form issues a re-frame event.
@sandbags also, be aware that in version 0.5.0, you specify :bootstrap-3 as an argument to form, not as an option inside the form, as I implemented an extension system (react-toolbox extension coming soon… hopefully). There’s also a debug extension now that can be useful to help figure out what’s going on when the form misbehaves.
@sandbags I’m glad you find the library useful and let me know if there’s anything else you’d it to do.
I'm running all the clojurescript tests in all 4 engines using ./script/test
- trouble is one of the Nashorn tests fails (pprint-table-tests) - where's the best place to discuss this? is there a dev channel?
@malcolmsparks: #cljs-dev is the place to go
Also, the pprint failures on Nashorn are probably not your fault and have been there for a while
@malcolmsparks we don’t care that much about Nashorn failures, it’s the most immature JS engine and it has problems with regard to the JS language specification and standardized quirks
thanks @dnolen - helps to know that
fwiw, it's the only failing test and it's to do with table formatting so probably not critical - I haven't been able to figure out what the test is failing on but I might have a go at fixing it
good to see how many tests there actually are in clojurescript, very impressive
Are .querySelector
and querySelectorAll
the right things to use in cljs to query the dom?
I'm having real trouble trying to iterate over them reliably.
the (println tr)
is never called, the first println prints a NodeList
I have this to make NodeList seqable: (extend-type js/NodeList ISeqable (-seq [array] (array-seq array 0)))
@danielstockton if you want NodeList
to be seqable that’s what you have to do
I know, the problem is that it still doesn't work the way I expect. Should items inside the seq be normal dom nodes that I can again query?
Can't work out why (println (seq (q-all table "tbody tr")))
returns nil
.....there are definitely tbody tr elements in the table
Thought it would be, but it's not proving that way.
I'm missing something weird
@danielstockton you can get a NodeList
from table
that contains children?
How would you verify it has children? Most of the methods on NodeList return an Iterator
@danielstockton pretty sure NodeList
is array-like
According to google closure docs, native Promise
should be polyfilled. I have some code using native promises, and the polyfill does not seem to be having an effect? Should I just use goog.Promise
?
Hmm, length is 0
@danielstockton it’s empty
Yeah, I just can't see why it would be empty 😞
@danielstockton console.log
table
, you should be able to mouse over that in Chrome and the element inspector will highlight it
if you see children in the element inspector then you have a race - the table is populated later
(println (.-length (q-all table "tbody")))
(println (.-length (q-all table "tbody tr")))
Here, the first is length 1 but the second is 0, perhaps querySelectorAll doesn't support this kind of selectorAh, i'll try that
you probably need to configure Google Closure to polyfill that - not sure how that’s done
probably not necessary though right? It looks like goog.Promise
has an equivalent interface
and for library code, it probably isn’t possible to configure google closure reliably right?
if you mean you want to use poly-filled Promise and it work for downstream library users
It's a race condition, no idea why though. If i initialize the table with a 1000ms delay in componentDidMount then it works fine.
If anyone happens to see the above thread, goog.Promise
works as a drop in replacement for native promises. :thumbsup:
@danielstockton yeah mixing React and serious DOM querying is unlikely to lead to fun results
I'll probably rewrite it in a more om/react friendly way. I'm trying to translate some jQuery that a designer came up with and don't think they're really compatible.
this is really really hard to read for me https://clojuredocs.org/clojure.core/require
Is there a good way of replacing a function defined in a library with one of your own (instrumenting it to debug it)? I've tried re-defining it via the Figwheel REPL and this works but is fiddly since the REPL isn't a good code editing environment. I tried create a new namespace and then re-opening the library namespace to redefine the function and this seemed to work for a while, then I started getting "Uncaught Error: Namespace "ajax.core" already declared." errors from the console.
@sandbags I don’t know about your other problems - but you can always set!
to replace some definition
but they are not using (fn ..) or (defn ..) but some kind of home-brew currying macro
maybe i am just tired from banging my head against this for several hours, or perhaps i am just not at the same level of understanding as you
but i'm not sure how I set! the return from a macro since that will be some form of def
ah but perhaps you meant to create your new function under a new name using the macro and then set one to the other?
@dnolen i don't see how that helps me. where do i get the "..." from exactly? Are you suggesting I pick through the macro expansion?
right, but my question was how I obtain the thing I want to pass as ... to the set!
call which wasn't obvious to me.
unless i just define my new function as e.g. json-read-2
and then set one to the other
yes but i don't have that (fn [] ..) ... okay let's stop there, thanks for trying to help
@sandbags but you’re instrumenting it, are you not going to write (fn [] …)
yourself ???
@dnolen at the risk of going around the circle again ... no, i am instrumenting their function
the snippet doesn’t make any sense to me yet. I’m just explaining how you should instrument in general.
@sandbags At the risk of further confusion: I sometimes just copy and paste the entire namespace into my src
folder (at the appropriate place for the ns), this means all the imports, namespace aliases etc are all available. And then just edit the code as you like. Once you're done, just remove the entire file.
however it looks like defining my own instrumented function and using set! has worked, so thanks again @dnolen apologies if i was being a bit dense but clearly not seeing on the same level as you
Repling into clojurescript via figwheel-sidecar.repl-api/cljs-repl, I'm getting swamped by huge error messages when large data fails in cljs.spec.test/instrument'd functions. Anyone know a way to intercept/limit the size of error messages in this context?
Any tips for debugging “Uncaught TypeError: Cannot read property 'getHostNode' of null” in a reagent app?
Reading the React issues, it seems like this is due to React getting into a funky state when previous errors are swallowed using e.g. promises, but I don’t have anything like that, unless reagent uses them internally.
I haven't seen that error before. Perhaps ask in #reagent channel to plug into broader experience. @cfleming
@mikethompson Thanks, I’ve asked over there.