This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-04
Channels
- # admin-announcements (9)
- # beginners (40)
- # boot (61)
- # cider (6)
- # cljsrn (5)
- # clojure (65)
- # clojure-gamedev (6)
- # clojure-greece (8)
- # clojure-ireland (1)
- # clojure-portugal (5)
- # clojure-russia (46)
- # clojure-uk (38)
- # clojurescript (177)
- # core-async (9)
- # cursive (17)
- # datomic (6)
- # dirac (8)
- # emacs (5)
- # error-message-catalog (8)
- # hoplon (248)
- # ldnclj (11)
- # ldnproclodo (1)
- # lein-figwheel (36)
- # leiningen (12)
- # mount (2)
- # off-topic (3)
- # om (26)
- # onyx (12)
- # perun (2)
- # planck (26)
- # re-frame (62)
- # reagent (55)
- # remote-jobs (2)
- # rethinkdb (1)
- # ring-swagger (14)
- # spacemacs (47)
- # untangled (69)
hello guys, i am experiencing a weird issue here. maybe someone knows and can help?
seeing an Uncaught TypeError: Cannot read property 'call' of undefined
here in latest Chrome
code is dead simple:
(ns abc.app
(:require [cljsjs.material-ui]
[cljs-react-material-ui.core :as mui]
[cljs-react-material-ui.reagent :as rui]
[reagent.core :as reagent :refer [atom]]))
(defn content []
[:main
[:h2 "Main Content"]])
(defn init []
(reagent/render-component [content]
(.getElementById js/document "app")))
what is :main
?
Also, my advice is to never :refer
atom
. Always use reagent/atom
. If you get in the habit of using atom
it is just a matter of time before you'll end up with a clojure atom, and that's a damn hard bug to find for anyone new.
============================================ EVERYONE The transition to React 15 appears to have been a success, There's now a [reagent "0.6.0-alpha2"] available. We are waiting on one more code drop from Dan. We will then cut a "release candidate". Please switch to using this alpha2 and tell us about any problems here: https://github.com/reagent-project/reagent/issues/212
@mikethompson: <main>
is a valid html tag
@mikethompson: thanks for the reagent/atom advice, will do
Which version of Reagent are you using?
[reagent "0.6.0-alpha" :exclusions [org.clojure/tools.reader cljsjs/react]]
Try alpha2 ... which will give you React 15
ok, trying now ...
ah, it worked - thanks
Apart from that, I can't see anything wrong.
Ah, good.
thanks man, you saved the day heh
I'm still suspicious of that main
Don't like these new-fangled things
it is a valid html tag with good semantics
@mikethompson: do you have an idea why alpha2 made a difference, the above error disappears?
My guess is that alpha2 is React15
My guess is that :main might not have be properly supported previous. But just a guess.
To test that theory, you could go back to alpha and replace :main
with :div
and see what happens
All gueses
@michael.heuberger: take care of main
as some browsers do not support it. this has bitten me once.
the caniuse website warns about some browsers not styling this element correctly. beware
ive been digging around for about 30 mins trying to find the root of this problem : No item [ .. some hiccup ] in vector of length 3
. Can anyone point me in a direction? My thoughts were maybe I’m accidentally returning a vector without a root (not tucked under a div or an ol, for example)… but that’s not it?
I am using map-indexed
in a few places, and was wondering if that’s screwing up reagent’s [function props…]
syntax somehow by clobbering a closure somewhere
Can you post the hiccup? @lwhorton
okay, this is a stripped down implementation:
(defn- render-row [{:keys [row]}]
[:ol
(vec (map-indexed (fn [idx it] [:li (str it)]) row))])
where I might invoke render-row via [render-row {:row [1 2 3]}]
when invoked in isolation, it produces the expected hiccup, but when invoked via a chain such as:
(defn render-list []
[:div (vec
(map-indexed
(fn [idx row]
[:li [render-row {:row [1 2 3]}]]) [1 2 3]))])
That’s when I get the No item in vector of length 3
error.can you sketch out what you are hoping to see in the dom? i am a little confused what you are trying to see
while moving those pieces over I figured it might be something with lazy sequences? if I use (into [:ol] (map-indexed …))
everything works fine, which makes me more confused.
would I have to use (vec (doall (map-indexed …)))
otherwise to get them to evaluate?
The result will be [:div [[:li ...] [:li ..]]]
try changing vec
to into []
or doall
thanks @hugobessaa thats enough for me to dig around on my own
@lwhorton I ran into this some times too. maybe reagent
could get a better error message for this case. it is pretty common mistake
it would be nice to at the very least say something like “you might be returning a nested vector"
yep, I agree
@hugobessaa: our app is for modern browsers only anyway, so <main> should be fine
i am having problems here defining a second level navigation with reagent + material ui:
(def nav-mail-link-list
(list ((mui/list-item {:primary-text "Domains" :key 1 :left-icon (icons/social-domain)})
(mui/list-item {:primary-text "Mailboxes" :key 2 :left-icon (icons/content-mail)}))))
(defn nav-link-list []
[rui/list
[rui/list-item {:primary-text "Dashboard" :left-icon (icons/action-home)}]
[rui/list-item {:primary-text "Mail" :left-icon (icons/content-mail) :nested-items nav-mail-link-list}]
that doesn't work and browser complains with core.cljs:2695Uncaught TypeError: Cannot convert a Symbol value to a string
shot in the dark, but you may have an extra set of parens in nav-mail-link-list. What happens if you try this:
(def nav-mail-link-list
(list (mui/list-item {:primary-text "Domains" :key 1 :left-icon (icons/social-domain)})
(mui/list-item {:primary-text "Mailboxes" :key 2 :left-icon (icons/content-mail)})))
aaaaah, that worked
I just published the in the modern-cljs series the 21th and 22th tutorials: Part I and Part II of a reasoned step by step guide to port the official react tutorial to reagent: https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-21.md and https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-22.md
@magomimmo: Thanks for sharing this!