Fork me on GitHub
#clojurescript
<
2017-10-18
>
iku00088807:10:28

I get this when I do a :simple or :advanced build, but would anyone have a guess? Cannot read property 'ReactCurrentOwner' of undefined

thheller07:10:46

@iku000888 react v16? I think they removed that.

thheller07:10:16

ah wait it work in :none? so then probably externs 😉

iku00088807:10:33

Suspected that 💥

iku00088807:10:49

app.js:193482 Uncaught TypeError: Cannot read property 'ReactCurrentOwner' of undefined
    at Object.r.116 (app.js:193482)
    at o (app.js:193479)
    at app.js:193479
    at Object.r.59.110 (app.js:193481)
    at o (app.js:193479)
    at app.js:193479
    at Object.r.30.10 (app.js:193480)
    at o (app.js:193479)
    at app.js:193479
    at Object.r.46.1 (app.js:193481)

iku00088807:10:35

So to elaborate

iku00088807:10:59

we have a gigantic bundle.js that is created with a npm script

iku00088807:10:50

which apparently :provides "cljsjs.react" "cljsjs.react.dom" "webpack.bundle"

iku00088807:10:23

But its still weird to me because I get the error with :simple optimization(Thought that would survive the renaming???)

thheller07:10:50

hmm true, that should work. do you generate a different bundle for dev/release? ie use a minified build in :simple but not :none?

thheller07:10:14

why do you do the bundle? didn’t you use shadow-cljs before?

iku00088807:10:53

Got a job with a project that was built with cljs compiler+figwheel up to now that needs to ship 😛

thheller07:10:20

hehe ok 🙂

iku00088807:10:49

Given the amount of npm dancing, I agree shadow-cljs would be a good choice...

thheller07:10:23

did you try the usual :pseudo-names debug to see where the ReactCurrentOwner is used?

thheller07:10:46

maybe that can give a clue

iku00088807:10:04

Giving that a spin

thheller07:10:19

wait .. nevermind

iku00088807:10:20

Really appreciate your time.

iku00088807:10:29

Was about to scream

thheller07:10:43

is the error above from a simple build?

iku00088807:10:05

as far as I can tell yes

thheller07:10:16

at Object.r.116 (app.js:193482)
    at o (app.js:193479)

iku00088807:10:18

but same error with :advanced

thheller07:10:28

that looks like errors on minified things

iku00088807:10:13

:pseudo-names true also yields same result

iku00088807:10:16

:thinking_face:

thheller07:10:39

yeah it looks like the issue is in the bundle. :simple should not have property names like that

thheller07:10:12

maybe you generate the bundle with webpack -p instead of webpack -d for dev builds?

thheller07:10:31

did you try the chrome debugger “Pause on exceptions” and debug that way?

iku00088807:10:03

Have not tried any of them! Will give a shot!

iku00088807:10:51

Could it be possible if

:foreign-libs [{:file "bundle.js"
                              :provides ["cljsjs.react" "cljsjs.react.dom"
                                         "webpack.bundle"]}]

iku00088807:10:20

then adding the react extern would do some magic?

thheller07:10:46

since :simple has the issue I don’t think :externs are the cause

iku00088807:10:47

(I am interpreting this as react is included in the bundle)

thheller07:10:24

you could try to including the bundle in a separate <script> tag and not telling the CLJS compiler about it

thheller07:10:52

that would at least sort out if the error is in the bundle or your app.js

iku00088807:10:30

that is something suspicious

iku00088807:10:58

so now I have both the script tag and the :foreign-lib

iku00088807:10:13

refering to the same bundle

thheller07:10:38

yeah just make the :foreign-lib refer to an empty file or so

iku00088808:10:22

Yeah, no luck.. Will try the other methodologies!

iku00088808:10:46

Now I identified that (react and react-dom) come from the bundle but react-dom-server is not

iku00088808:10:12

Trying to exclude react-dom-server

kah0ona12:10:15

maybe a stupid question, but… I just released my first cljs library to clojars, and included it in another project I am working on. However, in this project, I get Could Not Analyze errors when requiring the re-dnd.events namespace for instance. Are there special things I have to take into account before deploying to clojars? This is the lib in question: https://github.com/Kah0ona/re-dnd

kah0ona13:10:40

ah doh, forgot to add src/cljs to source paths in leiningen

fbielejec13:10:59

Is there a limitation on using cljs core/async <! >! macros inside another macro? I stumbled upon this problem and reproduced it in this repo: https://github.com/fbielejec/gotry The macro simply wraps a body in a go-try-catch block and it gives me:

Error: >! used not in (go ...) block

moxaj14:10:22

@fbielejec shouldn't that be :refer-macros [gotry] (or (:require-macros ...))?

moxaj14:10:49

also, why is the gotry macro in the :cljs branch of a reader conditional?

moxaj14:10:19

but you're not doing that

fbielejec14:10:35

it's a cljs-only macro for the simplicity of the example. Actually should probably be stripped of the reader conditional alltogether

moxaj14:10:33

clojurescript macros are implemented in clojure (unless you are using self-hosted)

fbielejec14:10:11

it's a nodejs build

fbielejec14:10:27

oh I see what you mean

fbielejec14:10:24

well initially the macro was written with both targets in mind, hence the conditional

moxaj14:10:21

if by targets you mean clojure/clojurescript, reader conditionals wouldn't really have helped you there (assuming you are using regular clojurescript), because for both targets the clojure reader would have read the file

fbielejec14:10:18

but the error indicates something else, i.e. that the outer macro is not expanded

moxaj14:10:12

having you tried my suggestions? :refer-macros and removed conditional

fbielejec14:10:15

just trying 🙂

fbielejec14:10:40

so the macro now becomes cljs.core.async.macros/go, and it works, thanks!

iku00088815:10:24

Has anyone else seen a cljs.tools.reader not found error when using a cljs compiler later than 1.9.671?

iku00088815:10:53

I currently avoid the problem by explicitely depending on tools.reader.

cjsauer16:10:17

What are you guys using for shared data validation between client and server?

cjsauer16:10:46

Anyone using clojure.spec? Or are there better libraries that help with form errors and things?

cjsauer16:10:04

I see that Luminus uses struct. Is that still a solid go-to?

dominicm16:10:28

struct is good I hear 🙂

dominicm16:10:30

I like vlad too

noisesmith16:10:47

prismatic/schema does portable data validation and it’s what my app uses since it’s a lot older than this new-fangled spec thing

cjsauer16:10:03

struct does seem pretty nice. I've been using it a bit and I really like how it handles error strings; very easy to pop into a form.

cjsauer16:10:52

I actually tried prismatic/schema out and found it really difficult to use, at least for form validation. I remember running into trouble with just simple (and () () ()) style predicates.

cjsauer17:10:10

It had sort of its own DSL for doing predicates that I couldn't pierce

dominicm17:10:52

@noisesmith did you find a good way for schema to have good user-facing messages? That's where it always fell down for me, even the humanizer created things like "42 is not a java.lang.String"

noisesmith17:10:35

@dominicm I pretty print the return value of s/check, which isn’t perfect but it usually helps me find the issue quickly

dominicm17:10:55

@noisesmith depends on what that message goes to I guess? 🙂

hkjels23:10:17

I’m just trying to update a few dependencies, but compilation blows up. Any ideas why I would get No reader function for tag Inf

noisesmith23:10:57

one of the more recent cljs versions fixes this, it's needed if you update to the more recent clojure 1.9 builds

hkjels23:10:36

I’m using [org.clojure/clojure “1.9.0-beta2”] [org.clojure/clojurescript “1.9.946"]

hkjels23:10:44

Indeed! Thank you 😄