lein-figwheel

octahedrion 2018-08-21T07:44:15.000100Z

no that error message has gone - now it only says [Figwheel] did not load (namespaces)

octahedrion 2018-08-21T07:45:40.000100Z

I have :mvn/version "0.1.8-SNAPSHOT" for figwheel-core and main in my deps.edn

octahedrion 2018-08-21T07:46:07.000100Z

but I get the same results

octahedrion 2018-08-21T07:49:04.000100Z

I looked in figwheel-core's github repo for a SHA to point at but the last commit was 7 days ago

octahedrion 2018-08-21T07:50:05.000100Z

I added ^:figwheel-load to the namespaces I'm changing but no change

octahedrion 2018-08-21T08:59:34.000100Z

ok I cloned figwheel-core and overrode in my deps.edn to use the cloned local version and now I get the previous error

octahedrion 2018-08-21T09:01:16.000100Z

Figwheel:FINE] Detected changed cljs files:  ("/my/ui/views.cljs")
[Figwheel] Compiling build dev to "public/js"
[Figwheel] Failed to compile build dev in 2.818 seconds.
[Figwheel] Compile Exception: Don't know how to write JSON of class java.net.URL  
[Figwheel:SEVERE] java.lang.Exception: Don't know how to write JSON of class java.net.URL
[Figwheel:FINE] {:cause "Don't know how to write JSON of class java.net.URL",
 :via
 [{:type java.lang.Exception,
   :message "Don't know how to write JSON of class java.net.URL",
   :at [clojure.data.json$write_generic invokeStatic "json.clj" 385]}],
 :trace
 [[clojure.data.json$write_generic invokeStatic "json.clj" 385]
  [clojure.data.json$write_generic invoke "json.clj" 382]
  [clojure.data.json$fn__2717$G__2712__2724 invoke "json.clj" 286]
  [clojure.data.json$write_object invokeStatic "json.clj" 335]
  [clojure.data.json$write_object invoke "json.clj" 319]
  [clojure.data.json$fn__2717$G__2712__2724 invoke "json.clj" 286]
  [clojure.data.json$write_array invokeStatic "json.clj" 348]
  [clojure.data.json$write_array invoke "json.clj" 342]
  [clojure.data.json$fn__2717$G__2712__2724 invoke "json.clj" 286]
  [clojure.data.json$write invokeStatic "json.clj" 475]
  [clojure.data.json$write doInvoke "json.clj" 424]
  [clojure.lang.RestFn invoke "RestFn.java" 425]
  [clojure.lang.AFn applyToHelper "AFn.java" 156]
  [clojure.lang.RestFn applyTo "RestFn.java" 132]
  [clojure.core$apply invokeStatic "core.clj" 661]
  [clojure.core$apply invoke "core.clj" 652]
  [clojure.data.json$write_str invokeStatic "json.clj" 482]
  [clojure.data.json$write_str doInvoke "json.clj" 477]
  [clojure.lang.RestFn invoke "RestFn.java" 410]
  [figwheel.core$compiler_warnings_code invokeStatic "core.cljc" 657]
  [figwheel.core$compiler_warnings_code invoke "core.cljc" 655]
  [figwheel.core$handle_warnings invokeStatic "core.cljc" 661]
  [figwheel.core$handle_warnings invoke "core.cljc" 659]
  [figwheel.core$start_STAR_$fn__4222 invoke "core.cljc" 781]
  [clojure.lang.ARef notifyWatches "ARef.java" 81]
  [clojure.lang.Atom swap "Atom.java" 83]
  [clojure.core$swap_BANG_ invokeStatic "core.clj" 2347]
  [clojure.core$swap_BANG_ doInvoke "core.clj" 2337]
  [clojure.lang.RestFn invoke "RestFn.java" 497]
  [figwheel.core$eval4238$build__4240 doInvoke "core.cljc" 841]
 ...

octahedrion 2018-08-21T09:05:33.000100Z

I get this error each time I edit this file, but it does compile because if I reload the page I see the changes

bhauman 2018-08-21T12:41:04.000100Z

@octo221 I didn’t push the change to the repo

bhauman 2018-08-21T12:43:02.000100Z

I just pushed the debugging code

bhauman 2018-08-21T12:44:40.000100Z

@octo221 This is fantastic. Now I know its data that’s in the warning. If you check out the latest figwheel-core and use it we should also see the actual data that is causing the error. I’m going to look at the warning data processing right now to see what the problem could be.

bhauman 2018-08-21T12:45:43.000100Z

@octo221 there is a :load-warninged-code option that will load the code even when warnings are detected and this may help in the short term? https://figwheel.org/config-options#load-warninged-code

bhauman 2018-08-21T13:02:05.000100Z

@octo221 ok I just pushed a fix for this to figwheel-core, it should make the exception go away

octahedrion 2018-08-21T13:51:00.000100Z

hi, I've cloned figwheel-core & am using it locally in my deps.edn (figwheel-core's deps.edn needs a :paths key)

octahedrion 2018-08-21T15:09:03.000100Z

I still get the error though

octahedrion 2018-08-21T15:09:54.000100Z

i checked I'm definitely using the local clone by changing the log message on line 304

octahedrion 2018-08-21T15:14:20.000100Z

sorry to be clear I still get the 'did not load' error not the JSON one

octahedrion 2018-08-21T15:53:52.000100Z

right - I've added ^:figwheel-load to the namespace I'm changing (I'm change the colour of something), and I've added some debug messages to figwheel-core in reload-namespaces, and I see that after I make a change, namespaces has 4 of my namespaces including the one I've changed, but to-reload is empty

bhauman 2018-08-21T17:56:41.000100Z

@octo221 OK so the JSON Error is no longer the problem and now we are having problems with reloading in general. I’m going to check out the reloading behavior for dynamically loaded modules

bhauman 2018-08-21T17:57:05.000100Z

I really appreciate you reporting this so that I can get to the bottom of this

bhauman 2018-08-21T17:57:41.000100Z

we’ve plugged one rare bug… let’s see if we can find the other one

octahedrion 2018-08-21T18:14:10.000100Z

ok I fixed a problem in a third-party lib that was causing a compilation warning about a single-segment namespace

octahedrion 2018-08-21T18:14:20.000100Z

and then I restarted figwheel main

octahedrion 2018-08-21T18:16:29.000100Z

now get this:

octahedrion 2018-08-21T18:16:31.000100Z

loading module my client core.cljs:192:16
log:Module loaded: cljs_base logger.js:367:5
 [goog.module.ModuleManager] Module loaded: cljs_base console.js:203:5
log:Module loaded: client logger.js:367:5
 [goog.module.ModuleManager] Module loaded: client console.js:203:5
> [my.ui.views my.ui.ui my.ui.module] core.cljs:192:16
 > [my.ui.views my.ui.ui my.ui.module my.ui.main] core.cljs:192:16
log:loaded (my.ui.views my.ui.ui my.ui.module) logger.js:367:5
 [Figwheel] loaded (my.ui.views my.ui.ui my.ui.module) console.js:203:5
log:really did not load (my.ui.main) logger.js:367:5
 [Figwheel] really did not load (my.ui.main) console.js:203:5 
- the > lines are to-reload and namespace respectively

octahedrion 2018-08-21T18:20:44.000100Z

and, it actually does reload but I have to force it to update by interacting with the UI somehow

octahedrion 2018-08-21T18:22:14.000100Z

e.g. if I change the size of something normally with lein-figwheel it would update and I would see the result, but here it updates and I only see the result after I do something in the UI to make react update

bhauman 2018-08-21T18:22:44.000100Z

on the same codebase?

bhauman 2018-08-21T18:23:15.000100Z

meaning when you used this codebase with line-figwheel it updated as you would expect?

bhauman 2018-08-21T18:23:28.000100Z

or is this a different codbase?

bhauman 2018-08-21T18:24:37.000100Z

@octo221 you probably need a reload hook to touch your atom to force a rerender

octahedrion 2018-08-21T18:25:06.000100Z

yes with this codebase lein-figwheel works fine

bhauman 2018-08-21T18:25:43.000100Z

yeah but you had a reload hook for lein-figwheel probably right?

bhauman 2018-08-21T18:25:59.000100Z

:on-js-reload ?

octahedrion 2018-08-21T18:26:02.000100Z

ummm

octahedrion 2018-08-21T18:26:09.000100Z

oh let me check

bhauman 2018-08-21T18:26:25.000100Z

and for figwheel-main you would use https://figwheel.org/docs/hot_reloading.html#reload-hooks

octahedrion 2018-08-21T18:26:52.000100Z

ahah yes in project.clj I had :before-jsload and :on-jsload

bhauman 2018-08-21T18:27:26.000100Z

so go ahead and use the new reloading mechanism and you should be good

bhauman 2018-08-21T18:27:38.000100Z

and here’s a reminder to use https://figwheel.org/config-options#load-warninged-code

bhauman 2018-08-21T18:27:52.000100Z

when you have a warning that is preventing reloads

octahedrion 2018-08-21T18:31:55.000100Z

and it works!

octahedrion 2018-08-21T18:32:07.000100Z

got it - thank you so much for all your help!

octahedrion 2018-08-21T18:58:10.000100Z

i completely forgot about :on-load

octahedrion 2018-08-21T18:58:22.000100Z

when I switched to deps.edn