Fork me on GitHub
#clojurescript
<
2018-03-02
>
derpocious04:03:02

For anyone who likes collecting points from answering SO questions 🙂

roninhacker04:03:08

Anyone know how I'd access react-dom/test-utils if i have access to react-dom?

roninhacker04:03:29

I realize I may be asking the wrong question here; I have reagent in dependencies, which has cljsjs.react-dom in its dependencies, and I can access ReactDOM from the REPL

zentrope04:03:06

Yes, interesting. I’m using rum and have the same issue.

zentrope04:03:26

The extern files suggest js/ReactTestUtils should work.

roninhacker04:03:14

I'm kind of getting the feeling that I should be using browserify...

roninhacker04:03:47

but on the other hand it seems a little ridiculous; TestUtils is right there in react-dom.inc.min.js

roninhacker04:03:22

I have to go @zentrope, but lmk if you find anything

zentrope04:03:56

I wonder if the cljsjs packaging is the issue.

zentrope05:03:31

When using rebel-readline is there a way to eval the whole form even when the cursor is in the middle of the form?

zentrope05:03:58

@dchristianbell I’m stumped. I looked at deps.cljs in the react-dom jar and tried requiring those namespaces at the figwheel repl, but no js/ReactTestUtils.

zentrope05:03:32

@dchristianbell However, in my main.cljs file, I could: (ns my.main (:require [cljsjs.react.dom.test-utils])) and then access the object in a function.

zentrope05:03:39

@dchristianbell And once I did a lein figwheel with that declaration, I could reference js/ReactTestUtils in the repl.

zentrope05:03:18

So, when using cljsjs libs, look at the deps.cljs in the jar and see if that clues you in. I hope I remember that myself. ;)

patrkris12:03:55

Does anybody else here have trouble using the externs generator here? https://jmmk.github.io/javascript-externs-generator/

patrkris12:03:12

I am not allowed to enter a URL

timo13:03:13

Hi, is anyone using maps a lot with re-frame? Is there a good alternative for CLJS to leafletJS?

valtteri13:03:17

I’d be also interested to hear any experiences on Leaflet/OpenLayers/others with CLJS since I’m planning to build a web-map-app and considering which framework to pick.

valtteri13:03:22

Meaning both the mapping framework and the web-app framework.

hkjels13:03:53

don’t know of any alternatives, but it’s already packed as a cljsjs. API looks simple enough

timo13:03:14

think so too... but do I have to build a form3-component with a map? I am a bit struggling with the component-update, like inserting markers. Would be glad to get an example to look at.

valtteri14:03:11

I’d love to use re-frame but I’m a bit worried how nicely Leaflet actually plays with React. I mean, does react-leaflet work with plugins etc, does react-layer just bring extra complexity there or is it actually nice to use. I haven’t done myself much research on this yet, but would like to know if there are certain pitfalls to avoid.

valtteri14:03:32

Maybe my concern is that if I take the re-frame + leaflet road, do I end up solving lots of cljs/react/leaflet/js interop problems instead of building my app.

timo14:03:07

I am right in it and it seems good to me, but still figuring stuff out

timo14:03:22

that's what I was searching for! Thanks!

timo14:03:09

type3-component

brunex14:03:06

hi, can someone help me what is the best way to deal with promises in cljs

(let [axios (js/require "axios")]
  (doto (.get axios "")
    (.then (fn [resp]
             (js/console.log "resp: " resp)))
    (.catch (fn [err]
              (js/console.log "err: " err)))))

brunex14:03:36

but allways getting: (node:26933) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): Error: Network Error

brunex14:03:24

the error is logged correctly on the console tho

brunex14:03:29

but that warning also

brunex14:03:07

not really, I guess what I need is some example of cljs code how to catch a promise error without that warning

roti15:03:34

how can I convert strings to ints? parseInt is weird.

joelsanchez15:03:02

what's weird about parseInt? you can use read-string but beware that it will also read anything that's valid cljs

thheller15:03:06

@brunex don't use doto use ->, reject should be a second fn param to .then

justinlee16:03:36

parseInt is definitely weird if you forget to specify the radix. then it behaves like it is possessed.

roti16:03:02

@joelsanchez parseInt("99aa") = 99, and it returns NaN

acron17:03:13

What's the 'supported' way of compiling CLJS these days? lein cljs-build ?

noisesmith17:03:14

supported by who? lein cljsbuild is a tool that uses lein, most things use clojurescript.jar in some way or another, there's a couple things out there that do self-hosted cljs

acron17:03:35

Well, perhaps "preferred" is a better term

acron17:03:55

I got the impression that the world had moved on from lein-cljsbuild

noisesmith17:03:12

that is, lein cljsbuild is a thing that uses lein to run cljs.jar to compile your cljs - figwheel gives an awesome interactive development experience (can run via lein or boot)

noisesmith17:03:31

that also uses cljs.jar

noisesmith17:03:10

@acron: my team uses lein figwheel during dev, and lein cljsbuild to make js to deploy, I think that's very common

acron17:03:40

Ok, fair enough, thanks

acron17:03:44

We use that also

noisesmith17:03:17

if you didn't know, the latest figwheel has an amazing repl with colorization and docs and multi line editing

leontalbot18:03:35

Hello guys! I wanted to decide whether I make a single project for both server/api + client/ui or whether we make two separate. What are you thoughts about this?

leontalbot18:03:50

Couldn’t find anything on Google in that regard yet

roninhacker18:03:21

You can do so in a single project

leontalbot18:03:03

any thoughts on why? Any rationale?

noisesmith19:03:26

in my experience working with a team, with a less disciplined group having separate repos for the frontend and backend leads to chaos and friction

roninhacker19:03:31

i misread your question; I thought you were just asking if you could. Depending on how tightly the two are coupled, it's probably just less overhead to keep them together

noisesmith19:03:49

to me it comes down to dev workflow - which would be worse, not knowing if your front and backend versions match (eg. can your team keep things flexible and compatible?) or having frequent merges in one codebase for totally unrelated work

noisesmith19:03:32

the more disciplined / careful the coding style, the more an advantage to separation

leontalbot20:03:27

Other question, not related: is :npm-deps for clojurescript on the server (node) or it can be used for requiring frontend js library like react-modal, etc. with regular clojure/java backend?

richiardiandrea20:03:52

@leontalbot I think it can be used for both, the caveat is that it is very very experimental

justinlee23:03:33

is there a codepen like thing for clojurescript where you can share working demos? preferably with the ability to import libraries like reagent