This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-04
Channels
- # admin-announcements (9)
- # beginners (40)
- # boot (61)
- # cider (6)
- # cljsrn (5)
- # clojure (65)
- # clojure-gamedev (6)
- # clojure-greece (8)
- # clojure-ireland (1)
- # clojure-portugal (5)
- # clojure-russia (46)
- # clojure-uk (38)
- # clojurescript (177)
- # core-async (9)
- # cursive (17)
- # datomic (6)
- # dirac (8)
- # emacs (5)
- # error-message-catalog (8)
- # hoplon (248)
- # ldnclj (11)
- # ldnproclodo (1)
- # lein-figwheel (36)
- # leiningen (12)
- # mount (2)
- # off-topic (3)
- # om (26)
- # onyx (12)
- # perun (2)
- # planck (26)
- # re-frame (62)
- # reagent (55)
- # remote-jobs (2)
- # rethinkdb (1)
- # ring-swagger (14)
- # spacemacs (47)
- # untangled (69)
@fasiha: Brilliant, thanks. These are exactly the type of thing I'm looking for. We're working on an after-hours project at work that's been amazing management with the speed of our progress, and we want to get up some nifty visualizations as fast as we can without breaking our flow. Creature comforts with just enough docs/tutorials to get some traction will help us establish that tight feedback loop.
We're trying to get our flag into the ground before the Scala contingent has staked out all the good territory.
@pataprogramming: cljs should be able to beat Scala then! I'm writing a real-time data visualization tool that just draws SVGs (with re-frame). It's been working very well so far. I've been rolling my own components and haven't needed to go down the rabbithole of using d3.js from cljs/re-frame/react. Good luck 😄
Cheers. Yesterday I was poking dispiritedly through Google searches for tutorials and feeling like I was going to be stuck in the weeds, but the path forward is opening up. Thanks for the links, everyone.
with cljs.js/eval, how do you eval forms that use functions in other namespaces ?
anyone know a popular Clojure(script) job board online? Seeking Clojurescript devs with React Native experience
@jarradhope: https://jobs.braveclojure.com/ and https://functionaljobs.com/ and the #C05006WDW and #C06B40HMY channels here.
@jarradhope: also the ClojureScript list is ok for job postings AFAIK
@bhauman: Have you tested Devcards with React 15 yet? I'm seeing some problems with Reagent + Devcards
I'll see if I can discover something, could be caused by something else also. Looks like the devcard function is at least called after updating the state.
@juhoteperi: @bhauman: FWIW Devcards + Om is working fine with React 15
@juhoteperi: I'm using React 15. Which version of reagent are you on?
Has anyone had issues with react dependencies (react/react-dom-server/react-dom) going out of order in advanced compilation mode using cljsjs? Should the lein deps :tree look a certain way to show that the ordering would be correct?
I believe Im getting errors due to react-dom-server being added before react in my compiled file
I am not but some of the libs depend on it
like reagent
its odd...when I run the reagent template form scratch it geneates in advanced mode perfectly fine
so it must be when there are other react deps..
just switched to alpha2
Here tell you what, I'll go bump my project and run my tests and confirm if that borks it.
that would be awesome
@sbmitchell: wrestling with a similiar issue at the moment, you can check cljs_deps.js to see the load order
I doubt that would bork it though bc the template uses alpha2 I believe
which brings me to my question, is there any way to influence the order of depencencies in cljs_deps.js?
@sbmitchell & @edannenberg : Can you post your :dependencies
? Maybe move reagent
to the bottom.
@xcthulhu: @puhrez here's a discussion of Elm from a Clojurian's point of view https://www.reddit.com/r/Clojure/comments/4hmx2i/beyond_clojurescript_elm/
@xcthulhu: alpha2. Do you have direct dep on React 15? Devcards will overwrite React version from Reagent.
@sbmitchell: Foreign-libs are ordered based on :requires entry on deps.cljs. React-dom-server doesn't currently require react-dom so the order is probably random.
@xcthulhu: Check your deps tree to see what React version you are really using. Or browser to check what React version is loaded.
xcthulhu: in my case reagent is actually loaded to early, trying to integrate https://github.com/madvas/cljs-react-material-ui, my best guess is that is caused by using danielsz/system which somehow pulls in reagent too early
looking at my system.clj and what it requires there should be no reason to pull in reagent at that point
@edannenberg: Cljsjs/material-ui contains completely custom React version and you need to exclude the normal version from your classpath completely.
Interesting very useful thanks @juhoteperi
I am using material-ui but I only have it temporarily bc I want to remove that dep for my own custom version 😛
that my be the problem...looks like Im replacing those components early
@juhoteperi: yea, the problem is that reagent loads react-dom and react-dom wants react, which exists after material-ui is loaded
@edannenberg: You should probably exclude react-dom from reagent
@edannenberg: no u don’t need to exclude react-dom
yea and i can't because reagent will then complain about missing react-dom
reagent is pulled in to early
@edannenberg: be sure this [cljsjs.material-ui]
is your first item in require
in your core cljs file
some of those need to be removed
but thats what I currently have...
some are specific to my company as well 😛
so what ordering are you guys suggesting...this generates a bad file in advanced mode
thanks for the work on getting that to place nicely 😉
I see you made that
yea, follow instructions in https://github.com/madvas/cljs-react-material-ui
yea looks like Id want to use an older clojar I cant support react 15 atm
is 1.8 13 or 14?
@juhoteperi: You were right, I wasn't using the right version of react
@madvas: it is top of my entry file, and looking at cljs_deps.js it is almost top but still not above reagent.
:dependencies [[cljsjs/react "15.0.2-0"]
[cljsjs/react-dom "15.0.2-0"]
[cljsjs/react-dom-server "15.0.2-0"]
[garden "1.3.2"]
[hiccup "1.0.5"]
[markdown-clj "0.9.88"]
[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.8.51"]
[prismatic/schema "1.1.0"]
[reagent "0.6.0-alpha2"
:exclusions [cljsjs/react
cljsjs/react-dom
cljsjs/react-dom-server]]]
Maybe a dumb quick fix is to: explicitly include react, make sure everything is in alphabetical order
so reagent works with react 15 has that been vetted?
@sbmitchell: alpha2 pulls in react 15.0.2 😉
heh oo
@sbmitchell: sorry, but cljs-react-material-ui
is including only react 15. and cljsjs/material-ui "0.14.4-11”
is kinda broken anyway, I don’t recommend using it
well Im trying to get rid of material-ui completely...maybe this just gives me reason to port over the components to my own
it was nice to start out but it was pretty easy to reverse engineer the components minus all the cooler animations to cljs
@madvas: I want to use google's material design, is material-design-lite good enough in your experience?
I sort of don't want to use any react components I can't just write in hiccup, since I want to just use hiccup server side for rendering.
It's an idea @yogthos espoused in a blog post last year born of his frustrations with server side rendering in javascript
@xcthulhu: imho material-ui
is so far most complete implementation of material design out there. material-design-lite
is pretty fair, but there yet
I found material-ui to be pretty good overall...not sure about the current versions but in previous versions stuff like dropdown menus did not work
dialogs...text fields...select fields are all solid
but if all you want is that floating label...you can just steal the css transform yourself and make a reagent component 😛
@sbmitchell: yea, but maintenance? 😄
@xcthulhu: with cljs-react-material-ui
you have choice writing hiccup or not. But I haven’t done any work on server-side rendering yet
reagent only material-ui TextField 😛
@madvas: I'm using this strategy by @yogthos https://yogthos.net/posts/2015-11-24-Serverside-Reagent.html
@sbmitchell: that’s a hell lot of code 😄
probably can be condensed...but eh iterations it does work 😛
@xcthulhu: yea, but for getting material-ui
work on server-side or whichever .js implementation of material, Nashorn or Node.js will be needed
@madvas: ok found the problem, routing got executed before reagent init in core.cljs, the routes are in a seperate file and used a ratom, so reagent was loaded before mui. >< adding mui above the ratom require in the routes files did the trick
@edannenberg: yea, good job. Again, [cljsjs.material-ui]
contains React, and must be required before Reagent or Om or other react framework, since react is in exclusions
This won’t be needed in future, it’s all just because of onTouchTap event, when React fixes that, [cljsjs.material-ui]
won’t need to include React
@edannenberg Im looking at that right now myself 😛
we must have very similar structured apps
@madvas yea i got that, just couldn't figure out why reagent was loaded first despite mui being top in core.cljs. but good to know that this will improve
@sbmitchell: hehe, i guess most reagent apps have a pretty similar structure. would also like so see some reagent native stuff with material-ui like feel. did you have a look at https://github.com/reagent-project/reagent-forms? could be a nice base for your own matrial efforts
Perhaps we should take on that effort 😛
I havent really tried adding animations in the react world yet
Im interested in looking into it however
what library would be a good idea to use for client side routing?
i know of secretary
but the last commit was Oct 2015
thanks for the suggestions guys! going to take a look at those
i’ve heard a lot about bidi
I use secretary with accountant
Working on a cljs+boot+reagent project. Need to read a project-local csv file as JSON. Is there some best CLJS way to do that (I usually use the d3.csv utility AJAX function in JS; not sure if there is some simpler way with cljs)
@gamecubate: what do you mean by “project-local csv”, are you going to read it from file/jar?
Nope. Web hosted, inside a data.csv file at the root level.
Should have mentionned this is for a web-hosted (index.html, main.js, style.css, data.csv, etc.) project.
If using jquery, I usually use the ajax function. If not, usually using d3.csv util function (I do a lot of dataviz for a living)
what about? https://closure-library.googlecode.com/git-history/docs/local_closure_goog_labs_format_csv.js.html
if it's not too much data you could process the csv to edn and embed it in the index html
d3.csv, for example, takes file path as argument and returns json object in the callback
Sometimes huge files, I would prefer to do it asynchronously
@darwin, this seems to be more for the parsing of a csv file.
@gamecubate: then you could also make an endpoint which does the conversion to edn on the server, if there is no https://github.com/clojure/data.csv in clojurescript
I should be clearer: I need to fetch a csv file, expecting a JSON object to be given to me (after some time)
@gamecubate: why do you want json instead of edn?
Professional deformation: I have been programming in JS (client side and, with node, server side) for 3 years. Just now trying to wrap my head around CLJS and not sure how to best proceed for the [asynchronous] fetching of file-based data. In JS, usually perform an asynchronous fetch, supplying a callback of form callback(err, json),
Are you saying that edn is the standard way to fetch remote assets with CLJS?
to store, I should say
@gamecubate: well, it makes life a lot easier if you stick to edn
@gamecubate: but you can transform json to edn fairly easy
@gamecubate: what I would do is use a good csv -> edn library on the server and send that to the client
I see I have more reading up to do. . Thanks for your advice. Will act upon it.
<googling edn cljs json csv>
googling on that combination doesn't make sense, since it doesn't matter how the edn was produced right
I guess that would be easiest, assuming that CJLS supports callbacks... which it does?
Ah man my head hurts. I need to more reading.
@gamecubate: of course, callbacks are just functions
... do more reading.
Will see if I can use d3 with CLJS, though it's binding of data to DOM (reagent managed) elements seems perhaps too stateful. Will need to experiment.
@gamecubate Speaking from my own integrations w/ d3, leaflet, etc. There is a common pattern in react with using a dom manipulating libs. You can do the same in cljs of course with reagent. Basically let the lib, i.e 'd3' do its thing and create a "container" component to wrap the data access to pass into d3 and update via the 'component-did-update' lifecycle. A good article I have seen is https://github.com/Day8/re-frame/wiki/Using-Stateful-JS-Components which is specific to reagent but there is another link at the bottom for the "general" principle
@sbmitchell: Same here. My work involves constant use of leaflet and d3 (I work for a Montreal newspaper). Thanks for the article link. Churning through it.
We use Leaflet a lot too, but I haven't touched much front end code yet, so never really used it yet
@sbmitchell, interesting article and pattern, that.
First goal: to translate above snippet to make it work in a boot-managed cljs project.
with help from reagent and using pattern mentioned in @sbmitchell link.
No marker data yet as I will need to fetch that, somehow. For now, just a map.
This took a bit of thinking to work out the kinks, hope it’s helpful for others
@borkdude: The assumption there is that the client is going to be Clojure(script) and accepting EDN? I have a similar problem. I have a React Native app, written in JS as the client, and currently consumes a flat JSON file. I was going to port my Data Parser from JS to Clojure to practice. So same sort of issue as @gamecubate has, but the input is a CSV and the output is JSON. EDN can be the intermediary for sure, but it still needs to output JSON at the end.
So what are the recommended tools to bring in data, parse/organize it, and output JSON? I’ve been using Cheshire a bit and that’s good for JSON output, but what about CSV input?
@lucaska: cljs was my assumption because @gamecubate mentioned that
The data is in a spreadsheet that gets updated once a week, I parse that CSV to JSON, build an array of JSON objects, and output to a file in the RN folder.
in JVM Clojure you could read the spreadsheet directly (using an Apache POI wrapper, several available) and then spit that data out with cheshire.
I just published the in the modern-cljs series the 21th and 22th tutorials: Part I and Part II of a reasoned step by step guide to port the official react tutorial to reagent: https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-21.md and https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-22.md