@vlaaad Something changed between 1.0.130 and 1.0.137 that now causes a stack overflow exception when evaluating that auto-table view code
java.lang.StackOverflowError: nil
in clojure.lang.RT.get (RT.java:761)
in clojure.core/fn--6114/fn--6115 (core.clj:3666)
in clojure.lang.MultiFn.invoke (MultiFn.java:233)
in clojure.core/pr-on (core.clj:3676)
in clojure.core/pr-on (core.clj:3670)
in clojure.core/print-prefix-map/fn--7343 (core_print.clj:233)
in clojure.core/print-sequential (core_print.clj:61)
in clojure.core/print-prefix-map (core_print.clj:229)
in clojure.core/print-map (core_print.clj:238)
in clojure.core/fn--7372 (core_print.clj:266)
in clojure.core/fn--7372 (core_print.clj:263)
in clojure.lang.MultiFn.invoke (MultiFn.java:234)
in clojure.core/pr-on (core.clj:3676)
in clojure.core/pr-on (core.clj:3670)
in clojure.core/print-prefix-map/fn--7343 (core_print.clj:233)
...
Hmm, I checked it (https://github.com/vlaaad/reveal/blob/master/examples/e04_tap_to_table.clj) before releasing 1.0.137, and that worked fine for me, can you share a repro?
(let [last-tap (atom nil)]
(add-tap #(reset! last-tap %))
(rx/view-as-is
{:fx/type rx/observable-view
:ref last-tap
:fn (fn [x]
{:fx/type :v-box
:children
[{:fx/type rx/value-view
:v-box/vgrow :always
:value (assoc (meta x) :_obj x :_class (class x))}
(if (or (nil? x) (string? x) (not (seqable? x)))
{:fx/type rx/table-view
:items [x]
:v-box/vgrow :always
:columns [{:fn identity :header 'value}]}
(let [head (first x)]
{:fx/type rx/table-view
:items x
:v-box/vgrow :always
:columns (cond
(map? head) (for [k (keys head)] {:header k :fn #(get % k)})
(map-entry? head) [{:header 'key :fn key} {:header 'val :fn val}]
(indexed? head) (for [i (range (count head))] {:header i :fn #(nth % i)})
:else [{:header 'item :fn identity}])}))]})}))
I added the extra v-box for metadata and value.
Hmm, still works fine... Could it be that you tap>
that form?
or maybe you do something like tap>
and then print it?
rx/view-as-is
is identity
since 1.0.137, and that means it will print the contents of the atom, that might cause issues if you tap that atom
Can you try this maybe?
(let [last-tap (atom nil)]
(add-tap #(reset! last-tap %))
(rx/stream-as-is
(rx/as
{:fx/type rx/observable-view
:ref last-tap
:fn (fn [x]
{:fx/type :v-box
:children
[{:fx/type rx/value-view
:v-box/vgrow :always
:value (assoc (meta x) :_obj x :_class (class x))}
(if (or (nil? x) (string? x) (not (seqable? x)))
{:fx/type rx/table-view
:items [x]
:v-box/vgrow :always
:columns [{:fn identity :header 'value}]}
(let [head (first x)]
{:fx/type rx/table-view
:items x
:v-box/vgrow :always
:columns (cond
(map? head) (for [k (keys head)] {:header k :fn #(get % k)})
(map-entry? head) [{:header 'key :fn key} {:header 'val :fn val}]
(indexed? head) (for [i (range (count head))] {:header i :fn #(nth % i)})
:else [{:header 'item :fn identity}])}))]})}
(rx/raw-string "tap-to-table-view" {:fill :object}))))
That doesn't render anything that can be right-click -> view'd
I'm not seeing how to make that render a view...
it should render "tap-to-table-view" text
Ah, I was still using 1.0.130 and that wasn't view
able but in 1.0.137 it is!
ah yes, 1.0.137!
Switched back to 1.0.137 and that seems to work as expected now. Thanks @vlaaad!
np!
haven't thought making view-as-is
an identity
would break anything...
(it's deprecated, 1.0.137 allows viewing cljfx descriptions directly)
I'm going to be doing some RDD talks to a couple of online Clojure groups so Reveal will be featured there 🙂
I'll show building a small web app in the REPL and one of the things I'll show is browsing the app in Reveal side-by-side with my editor.
I browse online docs that way too, using Reveal...
cool!
very curious to see it
Please ping me when the tasks will go live!
Sure. The date/time will get posted to #events once they are scheduled and I'll probably post links to the recording here for Reveal users 🙂