Browse Source

fix: posthog init failed

Tienson Qin 3 years ago
parent
commit
d7be05c0ea

+ 1 - 7
src/main/frontend/handler.cljs

@@ -183,12 +183,6 @@
         [{:url config/local-repo
           :example? true}]))))
 
-(defn on-load-events
-  []
-  (set! js/window.onload
-        (fn []
-          (instrument/init))))
-
 (defn clear-cache!
   []
   (notification/show! "Clearing..." :warning false)
@@ -215,7 +209,7 @@
     (register-components-fns!)
     (state/set-db-restoring! true)
     (render)
-    (on-load-events)
+    (instrument/init)
     (set-network-watcher!)
 
     (mobile/init!)

+ 2 - 1
src/main/frontend/modules/instrumentation/posthog.cljs

@@ -51,7 +51,8 @@
 (defn capture [id data]
   (try
     (posthog/capture (str id) (bean/->js data))
-    (catch js/Error _e
+    (catch js/Error e
+      (js/console.error e)
       ;; opt out or network issues
       nil)))