 ; we want to wrap stringified obj in a reference for further inspection
 (defn detect-else-case-and-patch-it [group obj]
   (if (and (= (count group) 3) (= (aget group 0) "#<") (= (str obj) (aget group 1)) (= (aget group 2) ">"))
-    (aset group 1 (reference (surrogate obj (aget group 1)))))) ; TODO change to direct reference after devtools guys fix the bug
+    (let [label (aget group 1)]
+      (aset group 1 (reference (surrogate obj label true (reference obj "inspect js object"))))))) ; TODO change to direct reference after devtools guys fix the bug
 
 (defn alt-printer-impl [obj writer opts]
   (if-let [tmpl (atomic-template obj)]

(ns devtools.format)

(def max-header-elements 5)
(def more-marker "…")


(defn header-api-call [value]
  (cond
    (surrogate? value) (aget value "header")
    (satisfies? IDevtoolsFormat value) (-header value)
    (cljs-value? value) (build-header value)))

(defn has-body-api-call [value]
  (cond
    (surrogate? value) (aget value "hasBody")
    (satisfies? IDevtoolsFormat value) (-has-body value)
    :else false))                                           ; body is emulated using surrogate references

(defn body-api-call [value]
  (cond
    (surrogate? value) (build-surrogate-body value)
    (satisfies? IDevtoolsFormat value) (-body value)))