Fork me on GitHub
#reagent
<
2016-01-22
>
sooheon09:01:15

Hey guys, has anyone encountered this error message using reagent or re-frame?

Load failed: Jsloader error (code #1): Timeout reached for loading script /js/main.out/tomaton/components/dashboard.js?zx=kgscuwybhheb
I’m not sure where the right place to start looking for the problem is.

hugobessaa10:01:26

It looks like a problem with the Google Closure Compiler. Maybe the host it is trying to fetch is not answering the request for the dashboard script on time

yenda11:01:34

is normal that I have to refresh my page when I change hiccup code to see it appear ?

yenda11:01:06

i'm using boot-cljs

sooheon12:01:37

@yenda: depends on what task ou have running. https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-01.md this guide explains the tasks well.

yenda12:01:18

sooheon: I already have an immediate feedback loop, for instance when I change a handler, I don't have to refresh

yenda12:01:29

however when I change a component it doesn't rerender

sooheon12:01:00

I thought it was boot-reload which took care of that. So you have that running?

yenda12:01:42

This is my core.cljs

yenda12:01:27

if I do a mount-root in the repl it refreshes the components like I would expect them

sooheon12:01:49

I havent used the system task, but I’m curious if it should come later in the task? Not sure.

sooheon12:01:16

just thinking out loud with you

yenda12:01:23

calling (reagent/force-update-all) works as well

yenda12:01:11

I think it is not the tooling but rather a thing with reagent/react

yenda12:01:32

since everything is effectively updated except for the components

yenda12:01:48

and (reagent/force-update-all) does the job

sooheon12:01:59

ah then it may be the way you wrote the components can I see it?

shaym12:01:09

@yenda: r u using figwheel?

sooheon12:01:26

I had a similar issue, and it was that I was using form-2 functions and not passing args to the inner fn

yenda12:01:26

@shaym no boot-cljs

shaym12:01:53

for figwheel i had to add a reload hook , you might need the same

yenda12:01:40

@sooheon: even simple components like

shaym12:01:16

hmmm does boot-cljs even does hot loading?

yenda12:01:40

@shaym: yes, like I said the components are not updated but the handlers and subscriptions are

yenda12:01:49

@shaym: how did you hook your function ?

yenda12:01:15

and wouldnt it work just as well with (reagent/force-update-all) ?

shaym12:01:52

@yenda: figwheel triggers the on-js-reload event whenever a file is saved, i believe that force update is "heavier" then a render

shaym12:01:55

@yenda: i believe that render does a diff , where force update recalculates the whole virtual DOM

yenda12:01:10

I suppose I should be searching for a hook in boot-reload then to seek the same behavior

shaym12:01:29

i suspect so

yenda12:01:01

(reload :on-jsload 'app.core/main)

yenda12:01:34

I wonder how boot could differenciate the cljs and clj core files

yenda13:01:30

it works simple_smile

shaym13:01:33

@jakemcc: i have considered FB , but i also need to hook up a db to the server , which is not easy to with FB

mpdairy18:01:07

does anybody know how to use the :on-set attrib in reagent's make-reaction function? I set a function for it like (fn [oldv newv] (println "on-set")) and it never prints

sashton20:01:30

@mpdairy: it looks like on-set is only called during reset!, which doesn't make much sense in a Reaction. However, this example will trigger it:

(def num (r/atom 5))

(def doubled (reagent.ratom/make-reaction #(* 2 @num) :on-set (fn [oldv newv] (println "onset" oldv newv))))

(println "num:" @num "doubled:" @doubled)
;=>num: 5 doubled: 10

(reset! num 7)

(println "num:" @num "doubled:" @doubled)
;=> num: 7 doubled: 14

(reset! doubled 11)
;=> onset 14 11

(println "num:" @num "doubled:" @doubled)
;=>num: 7 doubled: 14

sashton20:01:08

reset!-ing a Reaction will trigger the function, but then when it gets deref-ed again, it re-evaluates to the normal value (14)

mpdairy20:01:17

Ah, thanks @sashton, you are right

mpdairy22:01:58

Ok, now I can't get on-dispose to do anything but give me an error. I'm doing :on-dispose (fn [] (do (println "GOODBYE") true)) in make-reaction