我的应用程序正常工作,直到我决定升级到om-alpha26。 现在我得到了:无法阅读财产' force_children'未定义的
我尝试删除目标文件夹并执行' lein clean'无济于事。
google上没有任何内容,除了在project.clj中更新om版本之外,我没有做任何其他代码更改。我使用栗子作为我的开发环境。
这是我的project.clj:
:source-paths ["src/clj"]
:test-paths ["test/clj"]
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.145" :scope "provided"]
[ring "1.4.0"]
[ring/ring-defaults "0.1.5"]
[slester/ring-browser-caching "0.1.1"]
[bk/ring-gzip "0.1.1"]
[compojure "1.4.0"]
[enlive "1.1.6"]
[org.omcljs/om "1.0.0-alpha26"]
[environ "1.0.0"]
[com.datomic/datomic-pro "0.9.5327"]
[liberator "0.13"]
[cljs-ajax "0.5.1"]
[clj-http "2.0.0"]
[org.apache.httpcomponents/httpclient "4.3.5"]
[org.clojure/data.json "0.2.6"]
[overtone/at-at "1.2.0"]
[com.cognitect/transit-clj "0.8.281"]
[com.cognitect/transit-cljs "0.8.225"]
[com.stuartsierra/component "0.2.3"]
[http-kit "2.1.19"]
[com.taoensso/sente "1.6.0"]
[reaver "0.1.2"]
[clj-time "0.11.0"]
[differ "0.2.1"]
]
:repositories [["my.datomic.com" {:url "https://my.datomic.com/repo"
:username ["******"]
:password ["****"]}]]
:plugins [[lein-cljsbuild "1.0.5"]
[lein-environ "1.0.0"]
[lein-auto "0.1.2"]]
:min-lein-version "2.5.0"
:uberjar-name "ngbc.jar"
:cljsbuild {:builds {:app {:source-paths ["src/cljs"]
:compiler {:output-to "resources/public/js/app.js"
:output-dir "resources/public/js/out"
:source-map "resources/public/js/out.js.map"
:preamble ["react/react.min.js"]
:optimizations :none
:pretty-print true}}}}
:profiles {:dev {:source-paths ["env/dev/clj"]
:test-paths ["test/clj"]
:dependencies [[figwheel "0.3.9"]
[figwheel-sidecar "0.5.0-2"]
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.10"]
[weasel "0.7.0"]]
:repl-options {:init-ns ngbc.server
:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
:plugins [[lein-figwheel "0.3.9"]]
:figwheel {:http-server-root "public"
:server-port 3449
:css-dirs ["resources/public/css"]
:ring-handler ngbc.server/http-handler}
:env {:is-dev true
:browser-caching {"text/javascript" 0
"text/html" 0}}
:cljsbuild {:test-commands { "test" ["phantomjs" "env/test/js/unit-test.js" "env/test/unit-test.html"] }
:builds {:app {:source-paths ["env/dev/cljs"]}
:test {:source-paths ["src/cljs" "test/cljs"]
:compiler {:output-to "resources/public/js/app_test.js"
:output-dir "resources/public/js/test"
:source-map "resources/public/js/test.js.map"
:preamble ["react/react.min.js"]
:optimizations :whitespace
:pretty-print false}
:notify-command ["phantomjs" "bin/speclj" "resources/public/js/app_test.js"]
}}}}
:uberjar {:source-paths ["env/prod/clj"]
:hooks [leiningen.cljsbuild]
:env {:production true
:browser-caching {"text/javascript" 604800
"text/html" 0}}
:omit-source true
:aot :all
:main ngbc.server
:cljsbuild {:builds {:app
{:source-paths ["env/prod/cljs"]
:compiler
{:optimizations :whitespace
:pretty-print false}}}}}})
更新:
' force_children'功能不是我定义的功能。在堆栈跟踪之后,它看起来像是在(om.dom / div .... children)上调用的。当我从代码编译的表达式中删除子节点时,这里是代码:
(defui RootView
static om/IQuery
(query [this]
(let [bonus-subquery (om/get-query Bonus)]
`[{:bonuses ~bonus-subquery}]))
Object
(render [this]
(let [{:keys [bonuses]} (om/props this)]
(dom/div nil <--- ERROR OCCURS HERE
(dom/header nil
(dom/div #js {:className "search-header"}
(dom/a #js {:className "logo"})))
(dom/ul #js {:className "simple-sidebar"}
(dom/li nil
(dom/div #js {:className "fa fa-gift"})))
(dom/div #js {:className "row no-margin main-container"}
(dom/div #js {:className "col-xs-12 no-padding"}
(dom/div #js {:className "artist-songs-container"}
#_(dom/input nil "Title")
#_(dom/input nil "Bonus")
(dom/h6 nil "My Bonuses")
(apply dom/div nil
[(dom/h3 nil "Collect")
(bonus-list-view
(sort-by-posted bonuses))]))))))))
我怀疑它与栗子有关,因为当我将代码上传到heroku时,不会发生错误。这是堆栈跟踪:
> Uncaught TypeError: Cannot read property 'force_children' of
> undefined(anonymous function) @
> core.cljs?rel=1450501232093:143
>
>ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrCont>ext@react.inc.js:5933
>
>ReactCompositeComponentMixin._renderValidatedComponent
> @ react.inc.js:5953
>
wrapper @react.inc.js:12336
>
>ReactCompositeComponentMixin.mountComponent @
> react.inc.js:5566
>
>wrapper @
> react.inc.js:12336
>
>ReactReconciler.mountComponent @
> react.inc.js:12961
>
>ReactCompositeComponentMixin.mountComponent @
> react.inc.js:5571
>
>wrapper @
> react.inc.js:12336
>
>ReactReconciler.mountComponent @
> react.inc.js:12961
>
>mountComponentIntoNode @
> react.inc.js:10854
>
>Mixin.perform @
> react.inc.js:15613
>
>batchedMountComponentIntoNode @
> react.inc.js:10870
>
>Mixin.perform @
> react.inc.js:15613
>
>ReactDefaultBatchingStrategy.batchedUpdates @
> react.inc.js:8443
>
>batchedUpdates @
> react.inc.js:13689
>
>ReactMount._renderNewRootComponent @
> react.inc.js:11064
>
>wrapper @
> react.inc.js:12336
>
>ReactMount._renderSubtreeIntoContainer @
> react.inc.js:11133
>
>ReactMount.render @ react.inc.js:11153wrapper @
> react.inc.js:12336
>
>(anonymous function) @
> next.cljs?rel=1447028869174:1236
>
>(anonymous function) @
> next.cljs?rel=1447028869174:1079
>
>(anonymous function) @
> next.cljs?rel=1447028869174:1090
>
>om.next.Reconciler.om$next$protocols$IReconciler$add_root_BANG_$arity$4
> @ next.cljs?rel=1447028869174:1111
>
>om$next$protocols$add_root_BANG_ @
> protocols.cljs?rel=1447028869504:13
>
>om.next.add_root_BANG_.cljs$core$IFn$_invoke$arity$4
> @ next.cljs?rel=1447028869174:660
>
>om$next$add_root_BANG_ @
> next.cljs?rel=1447028869174:647
>
>om.next.add_root_BANG_.cljs$core$IFn$_invoke$arity$3
> @ next.cljs?rel=1447028869174:654
>
>om$next$add_root_BANG_ @
> next.cljs?rel=1447028869174:647
>
>ngbc$core$main @
> core.cljs?rel=1450501232093:240
>
>(anonymous function) @
> main.cljs?rel=1448073424172:14
>
>core.cljs?rel=1447680439306:164
谢谢!