Fork me on GitHub
#clojurescript
<
2015-08-09
>
paradoxquine02:08:36

that is delightful!

sander13:08:46

arohner: did you get it to work? my website http://sanderdijkhuis.nl/ is built with om and prerendered server-side. i use om.dom/render-to-str

sekao15:08:47

i’m trying to use cljs.js/eval. is there anything special I need to do to before running it? i tried evaling a simple form like (def hello “hi”) and it successfully generated cljs.user.hello = “hi”, but failed to run it because cljs.user is undefined.

dnolen15:08:58

@sekao you need to construct cljs.user somehow yourself

dnolen15:08:25

how to do it depends on many things - compilation level, JS environment

dnolen15:08:30

we can’t do it for you.

sekao15:08:33

thanks i’ll look into that

ericnormand15:08:47

@sekao: I just evaled "(ns cljs.user)", it seems to work

sekao16:08:03

@ericnormand: thanks that does indeed work

sekao16:08:13

@ericnormand: what i am trying to do is a bit more complicated, though. i’m reading a file form-by-form and evaling each one individually. this seems to break because cljs.js/eval wants me to supply a namespace, rather than remembering the one that was created the last time I ran it. I assumed the state atom would store that or something.

sekao16:08:27

it looks like i need to manage that myself. i’m reading the planck source code and it appears to keep track of the current-ns itself, so i’ll try to do something like that.

dnolen16:08:48

@sekao: state atom isn’t going to track the current ns, would create more complications than it solves

dnolen16:08:29

you need to track it yourself, all serious JS I/O is async so putting this info into the state atom would be very problematic

pleasetrythisathome16:08:25

@arohner did you have any success with server rending?

pleasetrythisathome16:08:44

I’ll take a look back at that old repo and see if I can get it to work with updated react versions

jeremyraines17:08:28

anyone here using Quiescent? If so, are you doing animations with it via the CSSTransitionGroup component?

dnolen17:08:53

documents what’s in master, plus some thoughts on further enhancement

ericnormand18:08:12

@sekao: ok, I see. that is more complicated than my solution can fix

ericnormand18:08:54

@sekao: I haven't had to do anything more than work in cljs.user so far

arohner19:08:26

@pleasetrythisathome: no, I didn’t get it to work

arohner19:08:45

@sander: what react version are you using for server-side rendering?

paradoxquine19:08:50

oh, looks like my problem yesterday was caused by using drip

paradoxquine19:08:38

what is the best reliable way to speed up jvm start times so lein and such run faster (without breaking a number of things like drip did)?

tcrayford19:08:13

@paradoxquine: run a cpu based profiler pointing at lein and figure out the reason it's slow and send pull requests

tcrayford19:08:47

HINT: it's not the jvm boot being slow (at least, likely not), the jvm boots in like 100ms on my machine, more loading clojure + your deps + your app's code being slow

tcrayford19:08:31

s/pull requests/jira tickets

paradoxquine19:08:50

@tcrayford: profiling that is a bit over my head at the moment but i’ll see what I can do simple_smile weird that it’d be my project or deps since my project was just 10 lines of vanilla clojure until just recently

tcrayford19:08:21

@paradoxquine: probably just loading clojure.core then, I'd guess.

tcrayford19:08:48

with larger projects/apps, getting a repl running and your code loaded typically goes up well past say, 30s, maybe a minute or two

tcrayford19:08:06

@paradoxquine: that's all for clojure. I'm gonna guess them thar things are very different in cljs land, but if you're running lein you still have the same problems somewhat

paradoxquine19:08:35

that is…worrisome. or maybe i’m just used to radically different ecosystems and it won’t matter

coyotespike19:08:08

I have a function which makes a Google map, then puts a marker on it, then does a .nearbySearch and does a loop-recur through the results to make a bunch of markers and put them on the map. This loop-recur works great when I'm using lein figwheel, but not after in a JAR after lein uberjar. I get the results back, but no markers get made. This puzzles me. I have the Google Maps externs file. Does anyone have any guesses as to why this isn't working?

sander19:08:56

arohner: using om 0.8.8, not sure which react version comes with that

sander19:08:24

arohner: 0.12.2 apparently

bensu20:08:04

@coyotespike: can you post a gist with both the config and the loop-recur code?

coyotespike20:08:18

@bensu: sure thing, here's a gist with the code (kind of fun because it's async and stuff anyway).

coyotespike20:08:41

I thought the info-windows' callback function might be causing a closure problem, but after removing the info-windows, the markers still don't work in an uberjar.

bensu20:08:05

@coyotespike: I'm assuming the code that goings into the uberjar has been compiled with :advanced

coyotespike20:08:41

Yep, that's right

coyotespike20:08:14

Since the code outside of the loop-recur works, I'm figuring that must the culprit...

bensu20:08:37

start by changing the name of first and rest, since they are clojure functions.

bensu20:08:16

then, you are accessing deeply nested properties of js objects, -geometry.location.G

bensu20:08:47

those might not be in the extern / or advanced might be munging them

coyotespike20:08:32

@bensu Both good ideas, let me try the first/rest thing

bensu20:08:48

for the other part, gobj is reccommended, look at this commit https://github.com/omcljs/om/commit/bac9908e4a8123c3b0e58715c1329b3b48ab01b6

coyotespike20:08:49

hmm...I'm using Reagent, does that make a difference?

bensu20:08:04

No, what I sent you was not about om, but about how to replace .-access by gobj

coyotespike20:08:19

@bensu: Wow, good recommendation - I put (js/console.log lat lon) in the loop-recur and got undefined undefined.

coyotespike20:08:46

So it's not accessing those deeply nested properties after compilation

paradoxquine20:08:59

i’m trying to bootstrap a very basic om application and I keep getting no target specified. running document getElementById in the fighweel repl also says that it can’t be found, but in the chrome console it finds the element without issue. how can I go about debugging such a case?

bensu20:08:23

@coyotespike: cool, then replace those property access by gobj as in the om commit

bensu20:08:56

@paradoxquine: can you show the code where you mount om (om/root my-component app-state {:target ...}) ?

bensu20:08:32

try (.getElementById js/document "om-test")

bensu20:08:53

I'm assuming that there is some dom node with id "om-test"

bensu20:08:28

Open question to cljs users. Anybody that has an package.json at their top level dir and interacts with npm routinely?

bensu20:08:07

I'm working on a cljs.test runner for karma, and I'm deciding how much of the npm config I can/should hide from the user

mfikes20:08:34

Trying to clarify high-level thoughts about the future of Planck. Feel free to comment here: https://gist.github.com/mfikes/c7da1e7dfded26c7ceb9

paradoxquine20:08:30

@bensu: no luck, same error

paradoxquine20:08:20

and yep, i do have a dom node with that id. for silly project reasons, it’s inside a template that is asynchronously rendered by angular, but the error happens even when i reload the code via figwheel, to it looks like it’s trying to bootstrap again, and the element is definitely on the page at the time it tries again

bensu20:08:13

can you make sure by putting a console log right before?

paradoxquine20:08:46

changed to

{:target (do 
    (. js/console (log "ran this code"))
    (.getElementById js/document "om-test"))}

paradoxquine20:08:54

and it logged successfully each reload

bensu20:08:11

sorry, I mean logging the result of getElementById

paradoxquine20:08:39

lolwut. it logs the element exactly as expected

paradoxquine20:08:38

i’m going to try something…om-tools is giving me weird warnings about macro redefinition or something way over my head. going to try without using it at all

bensu21:08:36

@paradoxquine: don't know what lolwut means simple_smile

bensu21:08:39

about the angular template. Remember that when you call om/root it establishes an async rendering loop of its own. I don't know how would that interact with the template

paradoxquine21:08:04

ah sorry, internet colloquialisms. not using om-tools didn’t help. i’ll try running in a page with literally nothing but the om-test id’d element and see

coyotespike21:08:23

@bensu: sorry to be thick, but I'm a little puzzled about get-prop usage.

paradoxquine21:08:17

darn, no luck there either. same error. i must be doing something really dumb

coyotespike21:08:24

(get-props "G" result), (get-props .-geometry.location result) yield an error, (.-prop result) yields undefined.

paradoxquine21:08:45

though now i’m getting the error invalid arity: 1 sometimes instead

paradoxquine21:08:24

thank you @jackjames, will fix that immediately now that i know

bensu21:08:40

@coyotespike: don't use get-props, read https://closure-library.googlecode.com/git-history/docs/namespace_goog_object.html getValueByKeys and access the js properties using that function

coyotespike21:08:31

@bensu: ah, enlightenment dawns simple_smile

paradoxquine21:08:45

huh, so it’s entirely the way i was making the function? time to read more beginner docs I guess simple_smile

bensu21:08:20

@paradoxquine: #([:h1 "a"]) tries to call the vector [:h1 a] as the function. That error is probably unrelated to the :target not found

coyotespike21:08:56

@bensu - damn, that totally worked! simple_smile

coyotespike21:08:45

Thanks for your help, that would've taken forever to figure out. I can see I need to do some reading on why using getValueByKeys is necessary in the first place

paradoxquine21:08:30

oh, i see. read up on that and makes more sense. thanks for your help simple_smile @jackjames and @bensu. that actually fixed the strange target error too