Fork me on GitHub
#cljsrn
<
2019-09-23
>
vikeri11:09:14

@xfyre Have you worked with reagent before? This guide could give you more insight: https://github.com/reagent-project/reagent/blob/master/doc/InteropWithReact.md

vikeri11:09:33

Also, has anyone thought about if inline requires would help us out with ClojureScript apps? http://facebook.github.io/react-native/blog/2019/03/12/releasing-react-native-059#faster-app-launches-with-inline-requires

thheller12:09:28

shadow-cljs in theory supports this. I just haven't found someone yet to actually use it in practice 😉

vikeri12:09:12

Ok nice! Supports this as in does supports the RN solution or does it by itself?

thheller12:09:08

it lets you split your code into multiple "chunks/modules" that can be loaded "lazily" via js/require

vikeri12:09:42

Ok nice, I’d have to define the different modules manually then? It seems the metro feature does this automatically

thheller12:09:28

yes, code splitting is static in CLJS. you define the boundaries

vikeri12:09:14

Check, so would I still need that feature in RN or is this standalone?

thheller12:09:47

RN deals with the loading so you need both

vikeri12:09:17

Ok I see. I define the modules and RN detects when they are used and handles the lazy loading?

thheller12:09:44

no clue about the second part. I haven't tested that yet. shadow-cljs just creates multiple .js files instead of one. How you load them is then up to you/RN. So if you load it in some componentWillMount or whatever lifecycle event it could be lazy

vikeri14:09:37

Nice, yeah we’re still on re-natal. But interesting to know that this would be a good way to improve performance.

xfyre11:09:25

@vikeri Of course. I managed to create HOC easy enough, but I’m still facing some weird issues I can’t properly explain.

vikeri11:09:14

@xfyre Okok! Yeah if you have a specific issue it might be easier to debug

Oliver George11:09:57

I'd like to include a datascript database in my app to save loading data from the network. I see that (js/require "./blah/data.json") works but it returns JS objects/arrays which kind of gets in the way of using transit format and desearializing.

Oliver George11:09:06

How do you bootstrap your app db?

danielneal12:09:17

at the moment, we bundle data as json files, but save data to async storage in strings made with transit

vikeri12:09:34

We do the same, serialize with transit and store to AsyncStorage

mynomoto13:09:11

How are you testing cljs react-native apps? I'm trying to understand the options and tradeoffs.

vikeri13:09:06

@mynomoto We only test business logic (never have any UI bugs thanks to re-frame + spec). We mock out everything RN specific and then we run the tests in nodejs.

mynomoto14:09:19

@vikeri Thank you! You are probably better than me, I still have ui bugs 😉. That is near our current setup but I wonder if there is a practical way to test react-native components on the native side or at least snapshot testing without going to much on the javascript side of tooling.

danielneal14:09:13

we are trying to use appium but oh boy it is hell

vikeri14:09:02

@mynomoto Maybe try reagent’s render-to-string?

vikeri14:09:21

My experience is that if you put all business logic in the subscriptions and then make sure they adhere to a spec you will catch 99% of the issues. The issue is usually that the subscription doesn’t return what you expect it to return

mynomoto14:09:18

@vikeri I will take a look, thanks. What worries me most about the ui is having broken state in which something should be rendered but isn't because of a typo. I don't want much from the ui tests but that would be nice to have.

mynomoto14:09:50

@danieleneal thank for letting me know, I will try to avoid that route while I can.

vikeri14:09:56

Sounds good

danielneal14:09:55

I think once we’ve got it working and integrated with ci it will start adding value, but it’s a hard slog atm with little payoff

danielneal14:09:04

detox is supposedly pretty good

mynomoto14:09:33

@danieleneal Detox seems really nice, thanks!