I am probably doing something wrong but I believe one of the om-next tutorials has some issues; specifically the autocomplete example. I was able to figure out one of the issues but there is another issue that is causing me some problems.
Once I put in more then two letters in the input box for autocompletion, the following code:
(defn send-to-chan [c]
(fn [{:keys [search]} cb]
(when search
(let [{[search] :children} (om/query->ast search)
query (get-in search [:params :query])]
(put! c [query cb])))))
produces the following error:
Uncaught TypeError: Cannot read property 'call' of undefined
core.js?zx=3jufl8vymlgw [452] om_tutorial.core.send_to_chan
next.js [3034] om.next.Reconciler.om$next$protocols$IReconciler$send_BANG_$arity$1
protocols.js [303] om$next$protocols$send_BANG_
next.js [1656] anonymous
I am not sure why this is the case.
Any help would be greatly appreciated.
Not sure if this is the right way to do things, but this is what I did to solve this issue.
Now the latest om is available on your system. (you can not just put it in your project file, because it is not on https://clojars.org/repo/ yet).
[org.omcljs/om "1.0.0-alpha23"]
. Then when the
auto-correction example comes up, I used the same project
configurations since there was no mention of how to configure the
project file again. It turns out that you have to use
[org.omcljs/om "1.0.0-alpha29"]
.Once that happens everything works although I get the following warning.
Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `om_tutorial$core$AutoCompleter`. See https://fb.me/react-warning-keys for more information.
That will be a fight for another day.
BTW.
Since I used the older version of om originally, just installing the new one did not solve the problem. lein clean
did not solve the problem either. I had to manually delete my om-tutorial/resources/public/js
folder. Then run lein run -m clojure.main script/figwheel.clj
.