diff --git a/src/main/shadow/cljs/ui/components/inspect.cljs b/src/main/shadow/cljs/ui/components/inspect.cljs index b521dc34..13e6c0d6 100644 --- a/src/main/shadow/cljs/ui/components/inspect.cljs +++ b/src/main/shadow/cljs/ui/components/inspect.cljs @@ -241,7 +241,7 @@ :tab-index (if active? 0 -1)} label])) -(defc ui-object-crumb [{:keys [nav-idx nav-from oid] :as stack-item} panel-idx active?] +(defc ui-object-crumb [{:keys [nav? nav-idx nav-from oid] :as stack-item} panel-idx active?] (bind object (sg/kv-lookup ::m/object (or nav-from oid))) @@ -256,6 +256,7 @@ (render (<< [:div {:class (css :border-r :p-2 :cursor-pointer :truncate {:max-width "160px"}) :style/font-weight (if active? "600" "400") + :style/font-style (if nav? "italic" "normal") :on-click {:e ::m/inspect-set-current! :idx panel-idx}} label]))) diff --git a/src/main/shadow/cljs/ui/db/inspect.cljs b/src/main/shadow/cljs/ui/db/inspect.cljs index ed7434dc..bdd2e89e 100644 --- a/src/main/shadow/cljs/ui/db/inspect.cljs +++ b/src/main/shadow/cljs/ui/db/inspect.cljs @@ -402,7 +402,7 @@ (assoc-in [::m/inspect :current] (inc panel-idx)))))) :obj-result-ref - (let [{:keys [oid ref-oid from summary]} + (let [{:keys [oid nav? ref-oid from summary]} call-result obj @@ -418,6 +418,7 @@ (-> (subvec stack 0 (inc panel-idx)) (conj {:type :object-panel :oid ref-oid + :nav? nav? :nav-from oid :nav-idx idx}))] diff --git a/src/main/shadow/cljs/ui/db/relay_ws.cljs b/src/main/shadow/cljs/ui/db/relay_ws.cljs index b67882be..54bdda68 100644 --- a/src/main/shadow/cljs/ui/db/relay_ws.cljs +++ b/src/main/shadow/cljs/ui/db/relay_ws.cljs @@ -66,7 +66,9 @@ (str (str/replace js/self.location.protocol "http" "ws") "//" js/self.location.host "/api/remote-relay" - "?server-token=" server-token)) + "?id=shadow-cljs-ui" + "&server-token=" server-token + )) ws-ref (atom socket)] (swap! rt-ref assoc diff --git a/src/main/shadow/remote/runtime/obj_support.cljc b/src/main/shadow/remote/runtime/obj_support.cljc index 1f0b73da..07ec4550 100644 --- a/src/main/shadow/remote/runtime/obj_support.cljc +++ b/src/main/shadow/remote/runtime/obj_support.cljc @@ -16,11 +16,14 @@ :cljs [[cljs.repl :refer (error->str)]])) #?(:clj (:import [java.util UUID]))) -(defrecord Reference [obj]) +(defrecord Reference [obj extra]) -(defn obj-ref [obj] - (when (some? obj) - (Reference. obj))) +(defn obj-ref + ([obj] + (obj-ref obj nil)) + ([obj extra] + (when (some? obj) + (Reference. obj extra)))) (defn obj-ref? [result] (instance? Reference result)) @@ -170,7 +173,10 @@ (cond-> ;; only send new-obj :summary when requested (:summary msg) - (assoc :summary (obj-describe* this new-oid))))] + (assoc :summary (obj-describe* this new-oid)) + + (:extra result) + (merge (:extra result))))] (shared/reply runtime msg reply-msg)))) (catch #?(:clj Exception :cljs :default) e @@ -314,20 +320,22 @@ (or (vector? data) (list? data)) (let [val (nth data idx) nav (d/nav data idx val)] - (obj-ref nav)) + ;; using not= since the value might not be identical but equal + ;; nav may attach more metadata without altering actual value + (obj-ref nav {:nav? (not= val nav)})) (map? data) (let [view-order (cache-view-order state-ref entry (keys data)) key (nth view-order idx) val (get data key) nav (d/nav data key val)] - (obj-ref nav)) + (obj-ref nav {:nav? (not= val nav)})) (set? data) (let [view-order (cache-view-order state-ref entry data) val (nth view-order idx) nav (d/nav data idx val)] - (obj-ref nav)) + (obj-ref nav {:nav? (not= val nav)})) :else (throw (ex-info "nav not supported?" entry))))))