This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-12
Channels
- # admin-announcements (35)
- # beginners (18)
- # boot (257)
- # cider (14)
- # clojure (226)
- # clojure-china (1)
- # clojure-germany (2)
- # clojure-japan (91)
- # clojure-korea (3)
- # clojure-poland (11)
- # clojure-spain (37)
- # clojure-ukraine (1)
- # clojurescript (165)
- # code-reviews (33)
- # datomic (8)
- # editors (42)
- # euroclojure (2)
- # jobs (30)
- # ldnclj (72)
- # reading-clojure (5)
- # slack-help (5)
Hi. I’m trying to use cljs for a new project. It looks like a proper kludge to set up. I have a repl running at port 9000, done that repl/connect bit in my code and I can’t do anything in the browser console. what gives ?
actually nvm I got confused - the repl uses the browser instance. is there any way to make cljs do its thing in the chrome console ?
@shriphani: try
(enable-console-print!)
after that (println “Hello”)
should appear in the browser console.@shriphani: your browser console cannot understand cljs
that's what your repl is for in your terminal
the same way you can't type coffeescript into the browser console
what kind of gotcha’s is there to using advanced compilation? I’m using the google closure autocomplete, which is working in simple optimization mode, but not advanced
@cmdrdats: getting an error?
My #1 suspect at the moment is that I’m calling (cljs.reader/read-string) to pull the data from an html attribute (to get the list of stuff to autocomplete)
I call setup on the body node of the document on window load, from a separate namespace
cmdrdats: interop calls can be compressed when they shouldn’t be in advance compilation.
stuff like (.log js/console …), if you don’t have the correct externs
Does anybody know of client-side "routing" solutions that do not have an impedance mismatch with React? Something that would let me bind my component hierarchy to an URL scheme.
cmdrdats: Not sure about those. I don’t recall ever having a problem with properties tbh.
@jrychter: I asked you about it on twitter but I think I didn't fully get your explanation - do you mean tight coupling routing with components? as in passing a parsed decomposed url down to every component and letting it interpret it accordingly?
@zoldar: Yes, kind of. I want my component tree coupled to URL tokens. I'd like to be able to declare in every component how many URL tokens it consumes. That way you get composability: plug a component into your tree anywhere, and URL navigation just works.
@andrewmcveigh: so you’re saying I should be wary of any calls with js/ ?
@zoldar: I wrote a proof of concept back in 2009 (my "poor-man's react"), it's here: https://github.com/jwr/lemontree/blob/master/src/lemontree/tree.clj — although most of that code deals with functional rendering of the component (widget) tree using zippers and foldts.
@andrewmcveigh: I would have expected js/console, js/window, and js/document to be implicitly externed, surely?
Now, I can't use dynamic binding, because it's React that renders the tree. I could pass an extra parameter to all render functions, I guess. But I wanted to ask how people do it — the "flat routing table" model that we got from Ruby (I think) used by secretary, bidi, and compojure just doesn't fit React at all.
Maybe I'm missing something, but I just don't see how you can have menus and other components going 2-3 levels deep, mapped to URIs, and not go insane with the current "flat routing table" solutions.
cmdrdats: yep, js/console, etc. should be ok, but I’ve seen the “.log” get compiled down before.
Has anyone implemented an auth handler for secretary routing? There is a PoC referenced in this issue, but it seems to have gone quiet: https://github.com/gf3/secretary/issues/41
@andrewmcveigh: wow - that’s painful. in the externs, do I just need console.log = function(str) {};
cmdrdats: Yeah, something like https://code.google.com/p/google-code-prettify/source/browse/trunk/closure-compiler/console-externs.js?r=174 should do it
unusual I agree
But I guess maybe they’re not expecting you to use console.log in production code?
I think I'll drop both secretary and bidi and stick to just using pushy (https://github.com/kibu-australia/pushy) along with my own code for dealing with URI tokens.
Hi, I'm trying to port this JS lib to cljsjs: https://github.com/vaiRk/responsive-fixed-data-table/blob/master/src/responsive-fixed-data-table.js. Unfortunately the source code doesn't actually run in the browser, i.e. the line "var React = require('react/addons');" doesn't work (and would require some pre-processing using browserify or something). I'm considering raising a github issue asking to make the JS browser compatible. Is this a good idea, what verbage would you use to describe the problem and work needed?
@dnolen: I found a little typo in the docs of mori: http://swannodette.github.io/mori/#reduce -> r should be a
@jrychter: at least until now, I've just used routing as a proxy for altering parts of app state but your idea makes me think it over
@zoldar: that works for simple apps. But if your nav hierarchy goes 3 levels deep, it just doesn't fit anymore.
One other thing that bothers me: I'm switching from navigation based on directly modifying app state atom to navigation based on HTML5 history. It seems the latter is noticeably slower (200ms or so). Not good.
@cmdrdats you can always try with :pseudo-names true
, which is useful when debugging advanced compilation errors, but if you don’t have one I’m not sure how useful that’s going to be.
@cmdrdats: did that fix your problem? (externing console.log
)
@martinklepsch: I’m still busy testing, but I think the real problem was that I didn’t require cljs.reader
xD
@cmdrdats: @andrewmcveigh, console.log
should be externed by default as far as I understand: https://github.com/google/closure-compiler/blob/a1488d59c11fd535ded79d37c11cd418927782ce/externs/webkit_dom.js#L122
I need to start a greenfield om SPA with a bit of dumb backend code (it’s basically an admin section interacting with postgres)
@txus: brings different tradeoffs to the table but I’ve had a good time with Firebase once.
@jrychter that's how I started my template, converting a skeleton to a template might take some time, but in the end I found it easier, especially when applying changes. Can only recommend making a template ;-)
(BTW, I have this feeling of wasted work when creating lein templates, because there is no way to update an app once you create the template)
@jrychter: Right, but that's the same with a skeleton. I upgrade my template in multiple steps. When I want to add, upgrade something (recently the switch to reader conditionals for instance) I do that on the app I am working on. Then, if it works, I commit, have the changeset available. Then I create a new application from my template, apply the changes there, make sure again they work and then apply the changes to the leiningen template. Before I also used a skeleton, but copying out only what I need was simply not doable after a certain amount of changes to the base, This way I have a clean process and can profit from the work I make for updates in future apps too.
@martinklepsch, @andrewmcveigh - I suspect my problem has to do with js-obj - https://gist.github.com/CmdrDats/948559a228c0b9751004#file-autocomplete-cljs-L68 and https://gist.github.com/CmdrDats/948559a228c0b9751004#file-autocomplete-cljs-L64
would that be the correct way to send in the ‘renderRow’ and ‘selectRow’ functions into the constructors?
I see: v=new Qw(null,{renderRow:UC})
in the code, but nothing referencing renderRow
back out - so I’m guessing it’s incorrect
@martinklepsch, @andrewmcveigh - I fixed it - The problem was the js-obj: (js-obj “selectRow” (fn [] …)) won’t work, because it doesn’t get optimised in the advanced compiler mode
I needed to
(deftype AcRender [element]
Object
(renderRow [this row token node]
(render-row row token node))
(selectRow [this entry]
(select element entry)))
@cmdrdats: Ah, right… I completely glossed over that bit.
@andrewmcveigh: Now I have one more issue - the (.-catname data) is being optimized to b.fH 😕
aget
😉
whatis amanda
?
oh, it’s a frontend library of web admin components we’ve developed for our warehouse
man, what a pain: http://squirrel.pl/blog/2013/03/28/two-ways-to-access-properties-in-clojurescript/
https://github.com/myguidingstar/fence should help sometimes
anyone using reagent point me to the correct way to convert a reagent component to something that a plain react component will accept in place of a function that returns jsx?
@rsslldnphy: reagent.core/as-element
@samflores: that prints (str component), ie something like "spanspan139487299121537751054096nil" - am i still doing something wrong?
unfortunately the prop is expected to be a function, and that seems to return an object?
Warning: Failed propType: Invalid prop cellRenderer
of type object
supplied to FixedDataTableCell
, expected function
. Check the render method of FixedDataTableCellGroupImpl
.
util.cljs:127 Uncaught TypeError: props.cellRenderer is not a function
i can't get the page to load at all unless i wrap the hiccup in a fn, like:
(r/as-element (fn [] [:span "Hello world"]))
but in that case, the table renders fine but the span is rendered as a string
if you will not find solution in feasible time, try sablono's html
, like :cellRenderer (fn [cell-data] (html [:span "Hi!"]))
imho, for longer code snippets
:cellRenderer (fn [cell-data] (html [:span "Hi!"]))
works betterThanks @ul - I think I can see where you've done it in select-om-all - however I'm a bit wary of mixing reagent and sablono in the same project!
I guess I just need to work out what it returns and how that's different to what reagent is returning... thanks for the pointer
@shriphani: browsers will need to provide more hooks to support languages other than JavaScript, I’m not holding my breath
KA-BOOM https://github.com/clojure/clojurescript/commit/47947137127c9a724fafbeb17c5f7af7412809de
now we can use all of the stuff in npm, right? -grin-
do i correctly understand that is no need to provide extern for this type of foreign-libs?
@robert-stuttaford: needs more testing but that’s kind of the idea yeah. I suspect we won’t be able to do much better than Browserify, some libs just aren’t going to work.
yeah. this is a huge step forward for overall adoption, though. one less obstruction to integration into existing systems
applause to you, @maria!
@robert-stuttaford: thank you, but dnolen provided me with a lot of guidance for this, so applause to him too 😉
dnolen gets a lifetime achievement award for all he’s done for us
certainly changed my career for the better
@robert-stuttaford: absolutely agree
also @mfikes landed this goody https://github.com/clojure/clojurescript/commit/92551f1bc39a7d0a0235b94e871a9fe66475686f
awesome!
For CLJS-934, my attempt at explaining its effect for the end user is this blog post: http://blog.fikesfarm.com/posts/2015-06-09-def-vars-in-clojurescript-repls.html
@dnolen: hey david, I want to take some random tickets on Jira. If I just update the assigned to me is enough to signal that this-issue-is-mine-let's-rock-mode?
I think that what I really want to know is if there is some kind of formal process to inform and discover what people are working on
temporarily in Poland, but back in LDN on the 20th
@jeff try asking on #C0522EZ9N as well
@dnolen: look what I just found. A Dutch company named Om Next! http://www.omnext.com/
Hi everyone, I am rather new to using Cursive and I have a small problem. I open up the repl and switch to cljs. But it still seems to be a clj repl.
(js/Date.)
CompilerException java.lang.RuntimeException: No such namespace: js, compiling:(/home/kristo/.IdeaIC14/system/tmp/form-init2826178497227697999.clj:1:1)
Fishing for help here as well as from #C050AN6QW
@not-much-io: have you read the ClojureScript Quick Start?
@dnolen I have at some point, but didn't think I'd get much regarding Cursive there -> https://github.com/clojure/clojurescript/wiki/Cursive I was thinking I am just doing something wrong.
@not-much-io: not true, you need to understand the Quick Start to understand how to get a ClojureScript REPL in Cursive.
@dnolen Huh... hmm, I was expecting Cursive to just work, it seemed to have the everything covered, judging by the cljs option in the repl. Okay, I will look at the getting started guide. Thanks.
@not-much-io: it’s not really possible for it to “just work” in general, ClojureScript REPLs needs a JS environment in order to function
@dnolen: I am also using fighwheel in a terminal window, is the workflow supposed to be that figwheel and your normal REPL (for exploratory coding) are separate?
Alright, seems good. Thanks for the input.
@not-much-io: Have you tried following the instructions from https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-in-a-Cursive-Clojure-REPL ?
@shaun-mahood: Not yet, but I will. Looks helpful, thanks. (y)
the figwheel wiki method works, but there's a different figwheel/cursive workflow that is more along the lines of what @dnolen just described: https://www.refheap.com/101322
not really battle-tested, but seems to work here. nice to just open your project, mash the green button, and end up at a figwheel brepl (in the cursive repl pane)
here's a repo that you can just 1) clone 2) import into intellij/cursive, 3) hammer the green button: https://github.com/heretodaygonetomorrow/hey-kanye
Nice, will check out. Many thanks.
and then you'll probably want to update deps because it's been approx. 4 days since the repo was published and it's already 100s of commits behind cljs and everything else
@dnolen: do you know if/when your presentation at qcon ( https://qconnewyork.com/ny2015/presentation/demand-driven-architecture ) will be made available online ?