Closed sirmspencer closed 1 year ago
It looks like I can do #2 with set-loggers! For anyone using shadow the key for both is to call set-loggers from a preload in dev.
(ns sphere.utils.dev-preloads
(:require [re-frame.core :as rf]))
;; re-frame logging
(defn escalate-re-frame-warn [& r]
(if (= "re-frame: overwriting" (-> r js->clj first))
(apply js/console.error r)
(apply js/console.warn r)))
(re-frame.core/set-loggers! {:warn escalate-re-frame-warn})
I was also able to #3 with set-loggers!. For anyone using shadow the key for both is to call set-loggers! from a preload.
(ns sphere.utils.ci-preloads
(:require [re-frame.core :as rf]))
(defn escalate-re-frame-warn [& r]
(assert (not (= "re-frame: overwriting" (-> r js->clj first)))
(apply str r)))
(defn escalate-re-frame-error [& r]
(assert false
(apply str r)))
(re-frame.core/set-loggers! {:warn escalate-re-frame-warn
:error escalate-re-frame-error})
Regarding point 1, re-frame will warn about duplicates on the initial loading of code (up to the window "load" event) but after that, no warnings are issued (during hot code reloading). See https://github.com/day8/re-frame/issues/204
Regarding point 1, re-frame will warn about duplicates on the initial loading of code (up to the window "load" event) but after that, no warnings are issued (during hot code reloading). See #204
I had a guess that might be the case
2. Setting to make the message a full error. We don't have any use cases for re adding subs, so an error is more apt.3. A flag to fail during compilation would also be a great safety net. Basically, we would want it to fail in the ci deployment when we run tests, or build the ubar jar. Maybe a function that can check for duplicates, or any other warnings, that I can add to the test suite.