Fork me on GitHub
#clojurescript
<
2019-04-22
>
Michaël Salihi08:04:06

Hello everybody ! I use Shadow-cljs + Reagent + Firebase authentication for one project and without change, I have suddenly since 2/3 days this error message : TypeError: "'requestAnimationFrame' called on an object that does not implement interface Window" on Firefox ("TypeError: Illegal invocation" on Chrome)

Michaël Salihi08:04:50

This appears in when I reset a boolean ratom in this function

(defn on-auth-state-changed
  []
  (.onAuthStateChanged
   (firebase/auth)
   (fn
     [user]
     (if user
       (reset! auth? true)
       (reset! auth? nil)))))

thheller08:04:08

@admin055 interesting. please try setting :compiler-options {:fn-invoke-direct false} in your build config.

thheller08:04:15

I changed that default and it may be causing this

Michaël Salihi08:04:52

@thheller Nice ! I'll try this right now, thank you !

Michaël Salihi08:04:07

@thheller Perfect, the error's gone ! Thx very much for support and your amazing shadow-cljs and more ! 🙂

thheller08:04:24

hmm doh. I hoped that wouldn't fix it. 😛

thheller08:04:31

guess I'll revert back to the "safe" default

Michaël Salihi08:04:37

@thheller Haha 😄 Is this the commit who break something ? https://github.com/thheller/shadow-cljs/commit/0d72e0edb0d8583b965e2ae6042a5aee72190448 If I understand, it's for compilation speed optimization, right ? Src : https://cljs.github.io/api/compiler-options/fn-invoke-direct

thheller08:04:20

I tested it in my apps and it worked fine but I'm not using reagent so I missed that

Michaël Salihi08:04:15

Thx for the link (y)

lilactown20:04:55

Has anyone figured out a way to use clojure spec without including it in the release bundle?