Symbolic values (##NaN, ##Inf) rendered as null when formatted
It looks like the formatter is changing symbolic values to null during internal processing:
(pr-str ##NaN) ;; "##NaN" (pr-str [##NaN]) ;; "[##NaN]" (. js/console log #js [##NaN ##Inf ##-Inf]) ;; [NaN, Infinity, -Infinity] (. js/console log [##NaN ##Inf ##-Inf]) ;; [null null null]
This initial attempt seems to fix it - at least through inspection of the demo page with symbolic values added.
modified src/lib/devtools/formatters/helpers.cljs @@ -62,6 +62,11 @@ (defn bool? [value] (or (true? value) (false? value))) +(defn symbolic-value? [value] + (or (js/Number.isNaN value) + (= js/Number.POSITIVE_INFINITY value) + (= js/Number.NEGATIVE_INFINITY value))) + (defn instance-of-a-well-known-type? [value] (let [well-known-types (pref :well-known-types) constructor-fn (get-constructor value) @@ -76,7 +81,8 @@ (defn directly-printable? [value] (or (string? value) (number? value) - (bool? value))) + (bool? value) + (symbolic-value? value)))
I had no success getting it to pass the whole test suite. Some issues were just phantomjs/chrome differences[1], but others might indicate that this approach might conflict with other internal mechanisms.
[1] - e.g. Phantom seems to lack the safer Number.isNaN, but has the old isNaN.
We're running devtools with shadow-cljs:
thheller/shadow-cljs: "2.8.68"
binaryage/devtools: "0.9.10"
clojurescript: "1.10.520"