Fork me on GitHub
#clojurescript
<
2015-11-06
>
twillis00:11:09

Hey all, I just bumped some dependencies for a project i'm working on and now running lein figwheel errors with this...

clojure.lang.ExceptionInfo: No such namespace: cljsjs.react, could not locate cljsjs/react.cljs, cljsjs/react.cljc, or Closure namespace "cljsjs.react" {:tag :cljs/analysis-error}
however, lein cljsbuild once works just fine. anyone else run into this?

richiardiandrea00:11:00

No I did not have this problem bumping Figwheel, which other deps did you bump?

triss00:11:10

so for doing node.js style broadcasting from clojure server to cljs client is sente still the best option? Are there any others?

triss00:11:22

Or maybe is there a nice idiomatic wrapper for http://socket.io running on node.js?

bhauman01:11:40

@triss I would use websockets straight up.

triss01:11:38

ah ok, not thought of that/grokked it was possible...

triss01:11:57

thanks bhauman. do you know of any examples?

bhauman01:11:11

Not off the top of my head but I think the ws library is the node websocket library

triss01:11:11

thanks man. I might end up having a look. head scratching time.

aleksander10:11:44

Whats the best way to connect to MySql on Node? Should I use something like https://github.com/felixge/node-mysql?

rohit10:11:01

@twillis: did you update cljs version to the latest one? if so, you need to bump up figwheel or cljsbuild to the latest SNAPSHOT release.

twillis11:11:53

@rohit: thanks that fixed the issue.

martinklepsch12:11:50

Is there an equivalent to clojure.lang.IPersistentSet in ClojureScript?

martinklepsch12:11:25

@dnolen: ok so with Clojurescript the Persistent bit is just generally omitted?

dnolen12:11:56

yes but you’ll just want to look at the protocols to be sure

dnolen12:11:11

I don’t remember if http://cljs.info documents these ...

martinklepsch12:11:31

but they don’t refer to their IPersistent*equivalents as they usually do I think

dnolen12:11:08

right these are the same protocols since pretty much day 1

dnolen12:11:14

we haven’t changed them

martinklepsch12:11:56

IPersistentCollection has cons, empty & equiv while ICollection only has -conj — wheres the rest defined?

dnolen12:11:10

@martinklepsch: there is no correspondence like this

martinklepsch12:11:21

That’s what I’m just noticing ^^

dnolen12:11:26

Rich Hickey refactored the protocol design based on the interface design

martinklepsch13:11:12

(deftype PersistentHashSet [meta hash-map ^:mutable __hash] — what’s the role of hash here?

dnolen13:11:03

@martinklepsch: holds the hash code

dnolen13:11:33

it’s for hash code caching

thheller13:11:46

@martinklepsch: do you know why the cljsjs react externs contains React.ReactComponent when the es6 class is called React.Component?

martinklepsch13:11:19

@thheller: I wouldn’t be surprised if there is stuff from previous versions that didn’t get removed properly. PR welcome if you think that’s the case simple_smile

martinklepsch13:11:25

Oh do the externs not contain React.Component?

thheller13:11:45

no only React.ReactComponent in its place

martinklepsch13:11:46

I thought you were asking why they contain both. simple_smile

martinklepsch13:11:56

Then that’s probably a bug

thheller13:11:01

I think it should just be React.Component

thheller13:11:23

would be nice if someone could verify that

thheller13:11:51

not sure if React.ReactComponent is actually a thing

thheller13:11:07

@martinklepsch: I don't know boot, what do I need to run to get a local version of that cljsjs package?

martinklepsch13:11:34

@thheller: boot package build-jar will install the cljsjs jar into your local repo

thheller13:11:52

hmm nothing happens 😛

martinklepsch13:11:10

@thheller: make sure you have the latest executable. Maybe do export BOOT_VERSION “2.4.2”

thheller13:11:34

@martinklepsch: new version worked, had 2.2.0 from brew

martinklepsch13:11:50

@thheller: 2.4.2 is also in brew btw

thheller13:11:44

it gave me 2.4.1 just now

thheller13:11:55

but yeah I got it through brew

thheller14:11:45

ok verified that my problems were fixed by this

thheller14:11:02

would be great if someone with an actual react app in production can verify

thheller14:11:12

I only have some test stuff

martinklepsch14:11:26

@thheller: do the react sources contain a definition for React.ReactComponent? This sounds like something that should be documented in some changelog?

bojanx10014:11:33

Hi guys! Does anyone know syntax for putting a function in between text in html, hiccup? Example: [:h5 "We've sent a verification email over to you at " { #(get-user) } "."]. Thanks!

martinklepsch14:11:33

@bojanx100: there’s no syntax for that but you can use (str “Hello “ name “!”)

bojanx10014:11:11

@martinklepsch: Yes, this did the trick: [:h5 (str "We've sent a verification email over to you at " (get-user-and-count) ".")], Thanks!

martinklepsch14:11:00

In clojure there’s also format which can help with similar things.

bojanx10014:11:16

@martinklepsch: I actually prefer it that way like String.format(). Thanks for pointing that out!

denik14:11:45

(instance? js/String "foo")                                 
;;=> false 
(instance? js/Number 20)
;;=> false

denik14:11:33

I believe this should work according to: http://dev.clojure.org/jira/browse/CLJS-98

denik14:11:27

[org.clojure/clojurescript "1.7.145”]

dnolen14:11:41

@denik: no guarantee that will work

dnolen14:11:06

Use the standard predicates

denik14:11:54

@dnolen I’d like to check the type once and dispatch on that

denik14:11:02

for performance reasons b/c dealing with very large colls

denik14:11:30

nvmd found a solution, thanks david!

denik14:11:47

(condp = (type x) ...

dnolen15:11:43

@martinklepsch: you probably want to implement IFn and IPrintWithWriter

dnolen15:11:59

also IHash

dnolen15:11:00

IEquiv w/o IHash mean problems

dnolen15:11:49

also somebody should port https://github.com/ztellman/collection-check to ClojureScript

dnolen15:11:56

if this hasn’t already been done

martinklepsch15:11:26

haha, I was thinking that collection-check would be nice and then discovered there is no cljs version simple_smile

martinklepsch15:11:46

is IPrintWithWriter analogous to extending print-method?

dnolen15:11:34

@martinklepsch: yep like print-method

martinklepsch16:11:51

(hash-combine (hash comparator) (hash (seq coll))) — does this look right?

dnolen16:11:22

@martinklepsch: hashing the comparator doesn’t make sense to me

dnolen16:11:51

I would just hash the underlying collection and be done with it

dnolen16:11:28

unless you think people will be combining your collection with similar collections together in sets and hash maps

martinklepsch16:11:11

probably that won’t be the case. are there any downsides hashing it though? it seems appropriate to me.

dnolen16:11:42

the comparator is a function hashing identity values doesn’t make sense

dnolen16:11:44

don’t do it

dnolen16:11:16

if two people provide the same logical function (but different implement), their collections will hash different

dnolen16:11:22

very broken

martinklepsch16:11:47

I see, that makes sense. Thanks David simple_smile

martinklepsch17:11:52

ClojureScript documentation about all this Interface/Protocol/Type related stuff is sooooo much better than Clojure’s, 👏 👏 @shaunlebron

Tim17:11:07

@martinklepsch: link to those docs?

Tim17:11:12

I’d like to check it out

martinklepsch17:11:22

I use it via Dash.app which lets me easily sift out protocols only etc

Tim17:11:29

I think the clojure docs could be stronger

Tim17:11:47

I was looking around for add-watch

Tim17:11:57

ended up figuring it out from the hoplon docs

roberto17:11:27

I upgraded to cljs 1.7.170 and now my project won’t build 😞

roberto17:11:46

➜  zoom-recordings git:(play-back-url) ✗ lein figwheel
Figwheel: Starting server at 
Focusing on build ids: build_needs_id_7801
Compiling "target/classes/public/js/app.js" from ["src/zoom_recordings/ui"]...
Compiling "target/classes/public/js/app.js" failed.
java.lang.AbstractMethodError: Method clojurescript_build/core/CompilableSourcePaths._find_sources(Ljava/lang/Object;)Ljava/lang/Object; is abstract
 at clojurescript_build.core.CompilableSourcePaths._find_sources (core.clj:-1)

clojure.lang.ExceptionInfo: No such namespace: cljsjs.react, could not locate cljsjs/react.cljs, cljsjs/react.cljc, or Closure namespace "cljsjs.react" {:tag :cljs/analysis-error}

roberto17:11:28

it was working fine with 1.145

roberto17:11:40

I’ll revert to that version

martinklepsch17:11:37

@roberto I assume you also updated fighweel/cljsbuild?

roberto17:11:25

hmmm, I guess I’ll try that. But I can foresee it causing some pain in other projects when ppl upgrade.

roberto17:11:17

I was already in the latest figwheel

roberto17:11:31

upgrading to latest cljsbuild didn’t fix it.

kliph17:11:43

@roberto: I had the same problem, upgrading to lein-figwheel "0.5.0-SNAPSHOT" and lein-cljsbuild "1.1.1-SNAPSHOT" fixed it

roberto17:11:05

I upgraded to latest stable

martinklepsch17:11:33

The release notes mention that latest versions of these tools are required simple_smile

roberto17:11:07

oh, I didn’t read the release notes simple_smile

mfikes19:11:26

I made a #cljsrn channel to cover ClojureScript + React Native specific issues.

sander22:11:11

before i upgraded to idea 15, cursive added 'splice sexp' and other structural editing tools to the cmd-shift-a menu. i can't find them anymore, have they moved elsewhere? i updated to the v15 repo and cursive otherwise works fine

cfleming22:11:31

@sander: No, they shouldn’t have moved. Can you see them under Edit->Structural Editing?

sander22:11:06

@cfleming: yes they're still there and they work

cfleming23:11:25

@sander: I just tried, and I can’t find them with Cmd-Shift-A either.

cfleming23:11:38

Could you file an issue for that and I’ll look at it?

cfleming23:11:28

In the meantime, if you don’t want to bind them all to keys, you could try a quick list (Settings->Appearance & Behaviour->Quick lists). You can create one with the structural actions in it and bind a single key to it.

sander23:11:51

@cfleming: done: https://github.com/cursiveclojure/cursive/issues/1144 ! thanks will try, still can't decide upon nice keys for the splice and join commands which i tend to use a lot simple_smile

cfleming23:11:59

@sander: Thanks! I think the quick list should work pretty well.

cfleming23:11:44

@sander: BTW there’s also a #C0744GXCJ channel for these sorts of things.

sander23:11:43

oops, thought I was in there already