plumatic / dommy

A tiny ClojureScript DOM manipulation and event library
759 stars 74 forks source link

"PersistentArrayMap.fromArray is not a function" when requiring dommy.core #39

Closed sandyarmstrong closed 10 years ago

sandyarmstrong commented 11 years ago

This is literally my first hour with Clojure*, so I could be doing something stupid, but if I add (:require [dommy.core :as dommy]), I get the following JavaScript error during build: "PersistentArrayMap.fromArray is not a function". This prevents me from testing out dommy/listen! .

I am using lein-cljsbuild 0.3.2, which uses ClojureScript 0.0-1806.

I am able to use the sel and sel1 macros without any issue so far, as long as I leave out that :require.

sandyarmstrong commented 11 years ago

I've confirmed that this error goes away if I move back to lein-cljsbuild 0.3.1, which uses ClojureScript 0.0-1803. I am able to successfully use dommy/listen! .

I'm testing with dommy 0.1.1.

sandyarmstrong commented 11 years ago

Actually I'm at a loss now. After restarting my computer to install an OS update, I am experiencing the same bug again, even with lein-cljsbuild 0.3.1.

greywolve commented 11 years ago

i'm having pretty much the same issue, it does compile using cljsbuild but it errors in the chrome console: Uncaught TypeError: Object function (meta, cnt, arr, hash) { this.meta = meta; this.cnt = cnt; this.arr = arr; this.hash = hash; this.cljs$lang$protocol_mask$partition1$ = 4; this.cljs$lang$protocol_mask$partition0$ = 16123663 } has no method 'fromArrays' modern.js:23121 dommy.core.special_listener_makers.cljs.core.into.call.cljs.core.map.call.cljs.core.ObjMap.fromObject.﷐:mouseenter modern.js:23121 (anonymous function) modern.js:11933 lazy_seq_value modern.js:8853 cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 modern.js:8898 _seq modern.js:3475 seq modern.js:4410 seq_reduce__3 modern.js:6664 seq_reduce modern.js:6688 reduce3 modern.js:6776 reduce modern.js:6790 into modern.js:12423 (anonymous function) modern.js:23117

sandyarmstrong commented 11 years ago

I did a git clean to remove all of my build products, etc. After that, it started working again with lein-cljsbuild 0.3.1. However, I did another clean and bumped up to 0.3.2 and it still worked.

I think there must be something about how lein or clojurescript works that I fundamentally misunderstand.

greywolve commented 11 years ago

hmmm yeah i also just tried to create a brand new lein project, and everything appears to work now suddenly, strange?

aria42 commented 11 years ago

Hmm weird, I can't repro any of this. I'm going to close the issue unless someone else can make this happen.

sandyarmstrong commented 11 years ago

Sounds good. I'll reopen if I can ever figure it out. Everything's working now, though.

haywoood commented 11 years ago

I'm having this same issue when requiring dommy.core. Using lein cljsbuild 3.2 and dommy 1.1 I'll keep poking around but my application is basically 1 file for messing around with cljs.

emil0r commented 11 years ago

Not having this issue with dommy.core, but running into the same problem when trying to use just plain cljsbuild and the repl.

A small pastebin: http://pastebin.com/PynsSDcr

Also talked with someone on IRC who didn't have the problems. var k = cljs.core.PersistentArrayMap.fromArray([1, 2], true) produced errors for me, but not for him, while var k = cljs.core.PersistentArrayMap.fromArrays([1, 2], true) worked for me (but produced a result that looked wrong) and not for him.

Also important to note is that logging a {:id :blah} hash-map to the console in the browser worked fine when loading the script, but re-issuing the command through the repl produced the above error.

Hope this helps.

swannodette commented 11 years ago

This error means that something is out of date - stale target and/or .repl directories lying around. Make sure to always specify a ClojureScript version in the your project.clj and remember to wipe out target and invisible .repl directories to avoid any confusion.

akonring commented 10 years ago

Upgrading to dommy 1.2 solved the issue for me.