Fork me on GitHub
#fulcro
<
2018-04-10
>
troglotit08:04:45

Did anyone had React is not defined in fulcro&shadow-cljs project in production build?

tony.kay13:04:51

@troglotit The book (dev guide) is currently running a production build.

tony.kay13:04:44

I’m not sure if shadow + CLosure can rename React at this point…if so, then perhaps you’ve got some code that Closure isn’t seeing that isn’t getting the rename? Just guessing wildly here.

troglotit13:04:35

thank you, @tony.kay, but I’m afraid I’m facing really weird bug. I tried to reproduce it on clean lein new fulcro - catched it on adding semantic-ui-react, but on trying to validate again on clean lein new fulcro - couldn’t succeed

tony.kay13:04:13

ah, so it works ok now?

tony.kay13:04:23

do you mean that when you add semantic-ui-react you hit the problem?

troglotit13:04:13

I did hit once. But when tried to validate that - I didn’t catch the bug

tony.kay13:04:07

I’m sorry I’m not understanding you very well. If you still have a problem, you can post a github repository that demonstrates the problem (with instructions), and perhaps someone can spot the trouble.

troglotit15:04:55

I created a repo https://github.com/troglotit/fulcro-shadow-bug - the gist is that in watch mode everything works, but in release/production build - I have React is not defined exception. I wasted a lot of time on it, dont know what to do next

troglotit16:04:30

omg, it was because of namespaces ordering in :require

tony.kay17:04:26

that is a strange outcome

tony.kay17:04:33

which file?

tony.kay17:04:26

this isn’t right, for example:

tony.kay17:04:59

you have to actually require react, and not use it via js/ in shadow. Shadow doesn’t use cljsjs stuff.

troglotit21:04:32

in root.cljs - I had to put fulcro.client.routing lower than fulcro.client & fulcro.client.dom. I had this idea because sourcemapped stacktrace of exception was in routes.cljc (in fulcro) - it didn’t had any reference to React, so I didn’t even try that at first.

tony.kay04:04:41

but if you are using shadow-cljs, you should not be referring to js/React, but instead should be requiring it (if you use it) and using it by that name, and shown in the book. Your “fix” worked because by placing DOM first, you got react by proxy (e.g. they require it)…and that was just a lucky break, because those files use the old-style cljsjs requires, which cause the js symbol to be there.

troglotit08:04:35

I tried using [“react” :as react], tried commenting that whole declaration - still bug persists. I tried doing that before, and it was just like that.

piotrek20:04:05

Hi! I was playing with google-maps-react and I have an issue with HOC (higher order component) that is wrapping my Fulcro component that uses Map component from the library. It looks that props are not passed by Fulcro to my wrapped component. I have a repo with my sample code: https://github.com/pbzdyl/fulcro-google-maps-react-issue

piotrek20:04:18

If you take a look at components.cljc (https://github.com/pbzdyl/fulcro-google-maps-react-issue/blob/master/src/main/nes/ui/components.cljc#L46-L48) I have a factory that creates a wrapped component. The issue is that lat and lon props are not passed to MyMap component. Any hints what I am doing wrong?