This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-06
Channels
- # admin-announcements (2)
- # aws (3)
- # beginners (25)
- # boot (7)
- # cider (27)
- # cljs-dev (30)
- # clojure (106)
- # clojure-boston (1)
- # clojure-czech (3)
- # clojure-dev (3)
- # clojure-estonia (1)
- # clojure-italy (1)
- # clojure-russia (11)
- # clojure-uk (3)
- # clojurescript (83)
- # clojurex (1)
- # datascript (1)
- # datomic (21)
- # docs (7)
- # funcool (1)
- # hoplon (8)
- # jobs (2)
- # ldnclj (9)
- # leiningen (6)
- # om (6)
- # onyx (29)
- # re-frame (41)
- # reagent (64)
- # spacemacs (2)
- # test200 (1)
Is cljs.build.api/watch supposed to work for individual files in current directory? It's not reloading if I watch a single file, but if I put it in a directory (or watch current directory) it reloads. Couldn't find anything in JIRA, and according to https://github.com/clojure/clojurescript/blob/3ecf5aff4151b10d8abf2376f8fae735c61f28a6/src/main/clojure/cljs/closure.clj#L473 a file is compilable, which seems to be the only thing that the watch function requires. There might be something in the closure/watch function in how it checks for file changes.
Current hypothesis: namespace isn't matching path interpretation, which works ok for some things but not for watching it.
when using cljs in ios, is it possible to keep the cljs process running in the background (so even when the app is not shown)? not very familiar with ios dev, so i'm not sure what the sdk limitations are
Short write-up to clarify the above problem: https://gist.github.com/oskarth/de185c3e7e108af54619
cljs/closure uses java io WatchService, and this https://stackoverflow.com/questions/16251273/can-i-watch-for-single-file-change-with-watchservice-not-the-whole-directory seems relevant
Talking to myself here, but one option would be to pass in a an option (or detect that source is just a file) and add a filter in this section: https://github.com/clojure/clojurescript/blob/3ecf5aff4151b10d8abf2376f8fae735c61f28a6/src/main/clojure/cljs/closure.clj#L1799-L1804
again, probably a stupid question ā¦ but I have a Reagent component like
(defn selectize
[groups selection settings]
(let [id
(util/rand-uuid)
options
(vec @groups)
get-selectize
(fn [] (.-selectize (aget (js/$ (str "#" id)) 0)))
selectize!
(fn [this]
(let [node (reagent/dom-node this)
html (str "<input id=" id " name=\"groups\"></input>")]
(set! (.-innerHTML node) html)
(.selectize
(js/$ (str "#" id))
(clj->js (assoc settings :options options)))
(.setValue (get-selectize) @selection)))]
(reagent/create-class
{:component-did-mount selectize!
:component-did-update selectize!
:component-will-unmount #(.destroy (get-selectize))
:reagent-render
(fn []
(deref groups)
[:div])})))
where groups is an reagent atom that gets initialized via Ajax. The component gets called with
(let [annotation-types (cursor app-state [base-state :annotation-types])]
(get-semantic-types! annotation-types) ; AJAX get and reset the atom
(fn []
[selectize
annotation-types
(atom [])
{:delimiter ","
:persist false
:labelField "name"
:valueField "id"
:onChange (fn [e] (.log js/console e))}]))
but on the initial render/update options is null what am I doing wrong herethe value is actually set (verified with the the deref)
hmm inlining the options fixes it
weird
how do you guys debug something like this?
football.server> Compiling "resources/public/js/app.js" from ["src/cljs" "env/dev/cljs"]... Compiling "resources/public/js/app.js" failed. clojure.lang.ExceptionInfo: failed compiling file:env/dev/cljs/football/main.cljs at clojure.core$ex_info.invoke (core.clj:4593) cljs.compiler$compile_file$fn__4652.invoke (compiler.cljc:1344) cljs.compiler$compile_file.invoke (compiler.cljc:1306) cljs.compiler$compile_root.invoke (compiler.cljc:1381) cljs.closure$compile_dir.invoke (closure.clj:438) cljs.closure$eval5096$fn__5097.invoke (closure.clj:478) cljs.closure$eval5048$fn__5049$G__5039__5056.invoke (closure.clj:383) cljs.closure$eval5109$fn__5110.invoke (closure.clj:492) cljs.closure$eval5048$fn__5049$G__5039__5056.invoke (closure.clj:383) clojurescript_build.core.CompilableSourcePaths/fn (core.clj:20) clojure.lang.PersistentVector.reduce (PersistentVector.java:333) clojure.core$reduce.invoke (core.clj:6518) clojurescript_build.core.CompilableSourcePaths._compile (core.clj:19) cljs.closure$build.invoke (closure.clj:1674) clojurescript_build.core$build_source_paths_STAR_.invoke (core.clj:160) figwheel_sidecar.auto_builder$default_build_options$fn__16255.invoke (auto_builder.clj:61) figwheel_sidecar.auto_builder$insert_figwheel_connect_script$fn__16301.invoke (auto_builder.clj:201) figwheel_sidecar.auto_builder$warning$fn__16252.invoke (auto_builder.clj:57) clojurescript_build.auto$time_build$fn__16059.invoke (auto.clj:56) clojurescript_build.auto$after$fn__16065.invoke (auto.clj:65) clojurescript_build.auto$after$fn__16065.invoke (auto.clj:65) clojurescript_build.auto$error$fn__16068.invoke (auto.clj:72) clojurescript_build.auto$before$fn__16062.invoke (auto.clj:61) clojurescript_build.auto$make_conditional_builder$fn__16080.invoke (auto.clj:104) clojure.core$mapv$fn__6727.invoke (core.clj:6616) clojure.lang.PersistentVector.reduce (PersistentVector.java:333) clojure.core$reduce.invoke (core.clj:6518) clojure.core$mapv.invoke (core.clj:6616) clojurescript_build.auto$autobuild_STAR_$fn__16162$state_machine__13470__auto____16163$fn__16168.invoke (auto.clj:187) clojurescript_build.auto$autobuild_STAR_$fn__16162$state_machine__13470__auto____16163.invoke (auto.clj:178)
no clue where to look really given this stracktrace
@andrea.crotti: you give https://github.com/thheller/shadow-build a shot, I'm fairly confident the error message will be more useful
I'd try cleaning the cache first. (e.g. lein clean
or rm -rf resources/public/js/
)
@andrea.crotti: that doesnāt look like a complete trace to me - please put that in a pasting service
hey all - anyone using closure goog.ui.Component objects with react? Iām interested in learning if/how goog.ui.Component lifecycle methods could possibly map to react lifecycle and be managed by react? Wondering if the two could work together? Or is it better to choose to go with one or the other (goog.ui.Component vs react component)?
Hello! any example tutorials of how to setup a clojure / clojurescript in the same Leiningen project ? ~ Full stack clojure i found this: http://www.clojured.com/ but not sure how relevant it is / isn't ... Thanks!
upgradingdave: I suspect bridging life cycles automatically will be more effort than it is worth. But I donāt see any issues with putting goog.ui components into React components
@dviramontes: there isnāt a canonical way to do that since it depends heavily on what tooling you want to use.
@dnolen: ok, thanks!
@dviramontes: what environment do you want to use Emacs/Vim/Cursive/SublimeText ?
@bhauman: which reminds me, Figwheel docs on how to use Component to start Figwheel + Ring together would be useful.
@dnolen: currently im on intellij with cursive
the sooner all important ClojureScript tooling moves towards accurate instructions on how to use these things as libraries, the better.
@dviramontes: then I would just stick with āinclude ClojureScriptā, you donāt need anything else with that setup.
@dviramontes: Figwheel also works well with this setup but the docs for newcomers is lacking
@dnolen: awesome, thanks again!
nice to know that goog.ui components can work inside react and that Iām not crazy for going down that route, thanks @dnolen
@upgradingdave: that one of the big value props of React life cycle you can control mutative components without too much difficulty
very cool, Iāve only used the react closurescript wrappers, I need to read more about react api to understand how the virtual dom actually works, such interesting stuff, thanks again
@andrea.crotti: be sure to check the figwheel server log
I'm attempting to upgrade from 1.6 to 1.7, but running into an exception when I compile:
Compiling "resources/public/generated/client.js" failed.
java.lang.IllegalStateException: Can't dynamically bind non-dynamic var: clojure.tools.reader/resolve-symbol
I've updated relevant libraries to be at latest stable, which leads me to believe it's something in our code
has anyone run into this issue before, and hints in things to look for?
this occurs when running lein cljsbuild once
@will_norman: sounds like you have tools.reader
conflict in your dependency graph
cool, will check that out
thanks!
interesting looks like there are several versions, is there one I should prefer? Looks like clojurescript is bringing in [org.clojure/tools.reader "0.10.0-alpha3"]
which seems to be the newest version, so I assume that one?
[org.clojure/tools.reader "0.8.10"]
is the latest non-alpha
@will_norman: ignore anything but the one that ClojureScript wants
awesome, will do, thanks again
Possibly more of a browser support/js question: Let's say I have a vector full of strings. Is there a way to download those as CSV client side, or do I have to pass through the server? I want it to be reliable.
I have a list of strings that I would like to join on \n
, then use the browser to download them. Like you would with a normal request response cycle with content-disposition attachment, but client side instead with clojurescript.
@jstew: I created this to do exactly that -> https://github.com/testdouble/clojurescript.csv
@bostonaholic: Thanks! That's amazing
then you can use it to "download" the csv file like so:
[a {:href (str "data:text/csv;charset=utf-8," (js/encodeURIComponent (csv/write-csv csv)))}]
And that should solve the other half. That's going to simply display the data rather than present it as a file download though. That may be good enough for what I'm up to.
yeah, my use cases have been a table of data with a "Download as CSV" link. I hold the table data as an atom and pass that to write-csv
heh, also using reagent š
Having an issue with porting some CLJ code to CLJS, have the problem down to one line and about whether a function name is fully qualified or not, the code works on in CLJ-land. Any ideas why itās different in CLJS? https://gist.github.com/mmower/c73f1d93528323717217
@sandbags: perhaps related to http://dev.clojure.org/jira/browse/CLJS-240? Doesn't give much info but the description looks like a match. Does the warning appear with all :optimizations levels?