Skip to content

Instantly share code, notes, and snippets.

@fredyr
Last active January 3, 2016 06:39
Show Gist options
  • Save fredyr/8424220 to your computer and use it in GitHub Desktop.
Save fredyr/8424220 to your computer and use it in GitHub Desktop.
(defn book [state owner]
(prn state)
(om/component
(dom/div nil (dom/h2 nil (:author state)))))
;;=>
{:author "Richard K. Morgan", :book "Altered Carbon"} core.cljs:55
Uncaught TypeError: Cannot read property 'string' of undefined core.cljs:110
;; Manual creation of a cursor giving the same behaviour
;; Inserted this snippet inside an om/component
(:author (om/MapCursor.
{:author "Richard K. Morgan" :book "Altered Carbon"}
{:books [{:author "Richard K. Morgan" :book "Altered Carbon"}
{:author "Neal Stephenson" :book "Snow Crash"}]}
[:books 0]))
;; =>
Uncaught TypeError: Cannot read property 'string' of undefined core.cljs:110
native_satisfies_QMARK_ core.cljs:110
(anonymous function) core.cljs:317
om.core.to_cursor.to_cursor__3 core.cljs:317
om.core.to_cursor.to_cursor core.cljs:311
om.core.MapCursor.cljs$core$ILookup$_lookup$arity$3 core.cljs:206
cljs.core._lookup._lookup__3 core.cljs:249
cljs.core._lookup._lookup core.cljs:249
om.core.MapCursor.cljs$core$ILookup$_lookup$arity$2 core.cljs:201
cljs.core._lookup._lookup__2 core.cljs:249
cljs.core._lookup._lookup core.cljs:249
cljs.core.get.get__2 core.cljs:943
cljs.core.get.get core.cljs:957
cljs.core.Keyword.cljs$core$IFn$_invoke$arity$1 core.cljs:2059
comment core.cljs:23
(anonymous function) core.cljs:426
(anonymous function) core.cljs:64
children core.cljs:64
om.core.Pure.React.createClass.getInitialState core.cljs:86
(anonymous function) react.js:4581
(anonymous function) react.js:9732
ReactMultiChild.Mixin.mountChildren react.js:9259
ReactDOMComponent.Mixin._createContentMarkup react.js:5514
(anonymous function) react.js:5443
(anonymous function) react.js:9732
ReactMultiChild.Mixin.mountChildren react.js:9259
ReactDOMComponent.Mixin._createContentMarkup react.js:5514
(anonymous function) react.js:5443
(anonymous function) react.js:9732
(anonymous function) react.js:4599
(anonymous function) react.js:9732
ReactMultiChild.Mixin.mountChildren react.js:9259
ReactDOMComponent.Mixin._createContentMarkup react.js:5514
(anonymous function) react.js:5443
(anonymous function) react.js:9732
(anonymous function) react.js:4599
(anonymous function) react.js:9732
ReactComponent.Mixin.merge._mountComponentIntoNode react.js:3813
Mixin.perform react.js:11888
ReactComponent.Mixin.merge.mountComponentIntoNode react.js:3789
ReactMount._renderNewRootComponent react.js:8616
ReactMount.renderComponent react.js:8665
(anonymous function) react.js:9732
rootf core.cljs:353
root core.cljs:366
(anonymous function) core.cljs:53
@edbond
Copy link

edbond commented Jan 15, 2014

I have no problem with this code:

(defn book [state owner]
  (prn state)
  (om/component
   (dom/div nil (dom/h2 nil (:author state)))))

(when (.getElementById js/document "watchlist-table")
  (om/root {:author "Richard K. Morgan" :book "Altered Carbon"}
           book
           (.getElementById js/document "watchlist-table")))

@fredyr
Copy link
Author

fredyr commented Jan 15, 2014

Note to self: don't use old, incompatible versions of Clojurescript!

(0.0-2127, instead of the required 0.0-2138)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment