The :hoplon: ClojureScript Web Framework - http://hoplon.io/
dave 2019-06-07T15:40:15.005200Z

@raywillig / @flyboarder i'm having a lot of trouble with hoplon/google-maps... my objective is really to update hoplon/google-loader (on which hoplon/google-maps depends) so that we can always load the google maps JS API over https i think pushing what's on hoplon/google-loader master to clojars as a new release is still a TODO item i've tried the following two things: • creating an adzerk/google-maps fork which includes the updated google-loader code directly in the repo • adding :exclusions [hoplon/google-loader] to my hoplon/google-maps dependency vector and pulling the updated source code directly into my project's repo when i do either of those, i get this console error upon page load:

core.cljs:316 Uncaught Error: No protocol method IDeref.-deref defined for type object: [object Event]
    at Object.cljs$core$missing_protocol [as missing_protocol] (core.cljs:316)
    at Object.cljs$core$_deref [as _deref] (core.cljs:671)
    at cljs$core$deref (core.cljs:1449)
    at HTMLInputElement.<anonymous> (input.cljs:8)
input.cljs is from my project, which i'm aware is not particularly helpful. anyway, any help would be appreciated, this is quite frustrating

dave 2019-06-07T15:40:49.005800Z

what i'm really hoping for is a new release of hoplon/google-loader that i can pull in and have it magically work 😅 i feel like there might be something special about building that dep that i'm not doing


@dave that error message looks like @e or similar is being used in an event handler

dave 2019-06-07T16:04:22.006600Z

this is the offending code in my codebase, unchanged for > 2 years:

(defn- change-state
  [state handler]
  (let [handler (or handler (fn []))]
    #(do (when state (reset! state @%))
         (handler %))))

dave 2019-06-07T16:05:05.007Z

i guess the issue is what's being passed in there

dave 2019-06-07T16:11:34.007400Z

it's very weird, though, because i didn't change anything about the code that calls that function

dave 2019-06-07T16:12:33.008Z

when i comment out calls to that function, that particular error goes away, but i'm also seeing this error:

core.cljs:717 Uncaught TypeError: elem.addEventListener is not a function
    at core.cljs:717
    at core.cljs:370

dave 2019-06-07T16:16:55.008400Z

traced it to this line in my code:

(on! $e :focus #(when (and (cell? disabled) @disabled) (.datepicker $e "disable")))

dave 2019-06-07T16:18:05.008800Z

which calls into here in hoplon.core...

(defmethod on! ::default
  [elem event callback]
  (when-dom elem #(.addEventListener elem (name event) callback)))

dave 2019-06-07T16:18:34.009100Z

so i guess $e ends up not being an elem in that case

dave 2019-06-07T16:20:14.009700Z

in my code:

(with-let [e ((input/input :type "text") (dissoc attr :state :opts))]
      (with-timeout 0
        (let [$e (js/jQuery e)]

dave 2019-06-07T16:22:38.009900Z

input/input is currently this:

(defelem input    [attr kids] (div) #_(field hoplon.core/input    attr kids))
so i don't get it. it seems like that ought to return an element (an ordinary div)


your code hasn’t changed, but hoplon has changed i think


in particular, something like @% in your original code doesn’t work by default anymore


% there is a jQuery event object, which in previous versions of hoplon cljs.core.IDeref was extended to, so that \@e would pull out the event’s value


at least… that’s my theory

dave 2019-06-07T16:51:04.013100Z

Aha. That sounds like a good theory. I'll see if I can chase it down after lunch. Maybe we were unexpectedly using an older version of Hoplon before due to transitive dependencies

dave 2019-06-07T17:45:22.016Z

it's weird... hoplon/google-loader does actually have a dependency on an older hoplon version, 6.0.0-alpha10: https://github.com/hoplon/google-loader/blob/21aaeaf5857e83a89469daf19ed5818d77daf2aa/build.boot#L5 however, when i remove :exclusions [hoplon/google-loader] from my hoplon/google-maps dependency vector and i do boot show -d, i don't see hoplon 6.0.0-alpha10 in there anywhere

dave 2019-06-07T17:46:14.017Z

i wonder if maybe when the latest hoplon/google-maps was pushed to clojars, whoever did it commented out the hoplon dependency

dave 2019-06-07T17:46:38.017300Z

that still doesn't explain the JS console error i'm running into, though...

dave 2019-06-07T17:47:25.018200Z

i guess it doesn't matter. it sounds like at any rate, if we're using hoplon 7.1.0, then we need to fix the issue @alandipert mentioned above, about cljs.core.IDeref no longer being extended to jquery event objects

dave 2019-06-07T17:47:45.018400Z

has anyone else here run into this?


if you scroll up to thurs. may 30th, someone else ran into it, in the context of making it work with gclosure

dave 2019-06-07T17:50:50.019600Z


dave 2019-06-07T18:19:10.019800Z

whew, i fixed it

dave 2019-06-07T18:19:37.020400Z

i'm not entirely sure why i have to do this now whereas i didn't before, but the fix was to require hoplon.jquery somewhere in my project

dave 2019-06-07T18:19:55.020900Z

i guess maybe that used to be required automatically (maybe by hoplon.core?) and somehow we ended up using an old version of hoplon before

dave 2019-06-07T18:20:14.021200Z

the version of hoplon we thought we've been using this whole time is 7.1.0

dave 2019-06-07T18:20:35.021700Z

but i suspect that maybe we ended up using an older version, unbeknownst to us, via transitive dependencies


oh yeah, requiring hoplon.jquery became necessary at some point

Ahmed Hassan 2019-06-07T21:11:56.023500Z

@dave @alandipert I ran into the issue of using @% to extract value of an event in Closure.

Ahmed Hassan 2019-06-07T21:17:44.025300Z

We already have gclosure, why shouldn't Jquery be made optional?


it is optional, you now have to opt in


and if you don’t opt in via (require hoplon.jquery) somewhere, you get dave’s error

flyboarder 2019-06-07T21:23:56.027300Z

Yes attribute providers are optional, so you can pick and choose your own library to handle implementation

flyboarder 2019-06-07T21:24:24.028200Z

We handle the default browser cases and leave you to include jquery or google closure on your own

flyboarder 2019-06-07T21:25:06.028800Z

This is well documented in the example code and the wiki