This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-06
Channels
- # 100-days-of-code (15)
- # beginners (32)
- # calva (2)
- # cider (37)
- # clara (1)
- # cljs-dev (47)
- # clojure (177)
- # clojure-boston (1)
- # clojure-dev (2)
- # clojure-germany (1)
- # clojure-greece (5)
- # clojure-italy (13)
- # clojure-nl (2)
- # clojure-sanfrancisco (1)
- # clojure-uk (72)
- # clojurescript (46)
- # cursive (20)
- # datascript (7)
- # datomic (14)
- # devcards (6)
- # docker (1)
- # duct (1)
- # emacs (1)
- # figwheel (3)
- # figwheel-main (151)
- # graphql (2)
- # hyperfiddle (1)
- # interop (3)
- # jobs (3)
- # lumo (2)
- # off-topic (21)
- # pedestal (1)
- # re-frame (9)
- # reagent (25)
- # shadow-cljs (57)
- # slack-help (4)
- # specter (21)
- # tools-deps (53)
- # vim (2)
Hmh. How should I debug "error rendering component" when all I get is
core.cljs:2944 Uncaught TypeError: Cannot convert a Symbol value to a string
at Array.join (:8800/native)
at Function.cljs.core.str.cljs$core$IFn$_invoke$arity$1 (core.cljs:2944)
at Object.cljs$core$pr_writer_impl [as pr_writer_impl] (core.cljs:10000)
at cljs$core$pr_writer (core.cljs:10009)
at core.cljs:10132
at Object.cljs$core$pr_sequential_writer [as pr_sequential_writer] (core.cljs:9863)
at Object.cljs$core$print_prefix_map [as print_prefix_map] (core.cljs:10127)
at cljs$core$print_map (core.cljs:10141)
at Object.cljs$core$pr_writer_impl [as pr_writer_impl] (core.cljs:9945)
at cljs$core$pr_writer (core.cljs:10009)
Sounds like there’s a JS Symbol somewhere
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
Es6 symbols are rarely encountered but React uses them under the hood
The same [:>] component in a let, with single pair of values works ok, but inside [:div (for)] it gives that symbol error
;Works
(let [selected-dows @(re-frame/subscribe [::subs/selected-dows])
[dayname number] ["Maanantai" "1"]]
[:> FormControlLabel
{:label dayname
:control (reagent/create-element
Checkbox
(clj->js {:checked (contains? selected-dows number)
:onChange #(re-frame/dispatch [:events/toggle number %2])}))}])
; Doesn't work
(let [selected-dows @(re-frame/subscribe [::subs/selected-dows])]
[:div
(for [[dayname number] [["Maanantai" "1"]]]
[:> FormControlLabel
{:label dayname
:control (reagent/create-element
Checkbox
(clj->js {:checked (contains? selected-dows number)
:onChange #(re-frame/dispatch [:events/toggle number %2])}))}])]
Even simply trying to log those above hiccups instead of rendering them will cause cljs-devtools to fail with the same error. Without devtools the difference is that for gives a lazy seq, with identical contents. So what's the symbol?
And for more context, it used to work with cljsjs material ui components, without the :>
too much going on in the example, can you boil it down?
if you ask me (into [:div])
is preferable anyway to the magic with lazy seqs
if you feel like it you can wrap the for
in a doall
@tomi.hukkalainen_slac might be related to this: https://github.com/reagent-project/reagent/issues/369
though the bigger issue appears to be in cljs-devtools itself https://github.com/binaryage/cljs-devtools/issues/25
there’s a patch to fix str
but it has stalled https://dev.clojure.org/jira/browse/CLJS-1628
amusingly i ran into this same issue when i was first starting out in clojurescript but forgot all about it https://clojurians-log.clojureverse.org/clojurescript/2018-01-19
@lee.justin.m I don't think so, since without the for everything works, as does when using into
@tomi.hukkalainen_slac yea, there are 2 layers of bugs: one is the ultimate cause of your error. the second level is the printing bug that makes it impossible to figure out what’s actually going wrong
ES6 Symbols are such a weird feature
without a literal to create them