Fork me on GitHub
#cljsrn
<
2015-12-27
>
artemyarulin07:12:33

Ha, cool idea. Added to the watch list

johannjohann07:12:43

have you poked around with how http caching works on android/ios within react native @artemyarulin ?

johannjohann07:12:49

or are you fetching stuff natively?

artemyarulin07:12:46

Yeap, I’m using XmlHttpRequest wrapper (fetch is just a wrapper around it). Under the hood it uses standard iOS cache staff

artemyarulin07:12:54

do you have any problems with it?

johannjohann07:12:12

no not yet just have been dancing around looking for its defaults

artemyarulin07:12:16

Usual issue there that http GET is cached by default

johannjohann07:12:36

i was thinking of trying to have a ETag on the remotes endpoint

johannjohann07:12:48

that hashes the query

johannjohann07:12:32

then have the client cache be responsible for remembering the last hashed query and maybe a last-modified

artemyarulin07:12:20

hm. The problem is that iOS maintain HTTP cache for each application, but it can free it whenever it decides to do so. So not kinda 100% reliable

johannjohann07:12:05

hmm yeah great point

johannjohann07:12:21

should look into what guarantees i get for the lifetime of the cache lol what a mess

johannjohann07:12:58

the dream was to push the statefulness to the edges and leave me with less to keep track of

artemyarulin07:12:20

Yep, I thought about the same. I even started a new project https://github.com/artemyarulin/react-native-raw-http which would delegate cache and cookie staff to some external handler so I can persists it on disk forever, but didn’t have a time to finish it

artemyarulin07:12:11

I guess in your case the easiest way to save Etag and hash somewhere on a disk

johannjohann07:12:35

yeah so im playing around with datascript

johannjohann07:12:17

maybe i can store the hash of the query in the transaction

johannjohann08:12:20

another question i had--have you done anything with nested navigators

artemyarulin08:12:58

btw - are working with android or ios version?

artemyarulin08:12:30

I have quite a strange issue - when Chrome debugger it not attached I have this error for android:

E/ReactNativeJS( 2003): { [TypeError: Object.freeze can only be called on Objects.]
E/ReactNativeJS( 2003):   line: 1555,
E/ReactNativeJS( 2003):   column: 14,
E/ReactNativeJS( 2003):   sourceURL: '' }

johannjohann08:12:52

have yet to play around with the latest figwheel setup on android but i will keep a lookout !!!

johannjohann08:12:52

are you catching all errors in the debugger?

johannjohann08:12:57

might be helpful to get more useful info

artemyarulin08:12:31

Well when I enable Chrome debugger this error goes away

johannjohann08:12:12

dude thats hilarious

johannjohann08:12:24

(and horrifying lol)

artemyarulin08:12:51

ending is nice

artemyarulin08:12:11

OK, maybe I’ll find a workaround - if I have chrome debugger attached I have Warning: qwerty$core$RootComponent(...): React component classes must extend React.Component, while without debugger it crashes just before this line in the log. So I hope that they are related

johannjohann08:12:49

maybe its a race condition

artemyarulin08:12:11

The thing I don’t understand why the hell js/require “react-native” doesn’t work

artemyarulin08:12:31

it always gives Required unknown module

artemyarulin08:12:32

looks like packages has a different handling of this root namepsace, as I can pretty much require anything else like js/require “TextInput”

johannjohann08:12:53

do you have to type out the full path or something?

artemyarulin08:12:49

yeah - I know that it works with full path

artemyarulin08:12:49

It should work without it

johannjohann08:12:05

wasnt sure if that covered it

johannjohann08:12:34

another thing i was mulling over

johannjohann08:12:48

is it possible to get source maps working when the code is being executed in workers?

artemyarulin08:12:25

hm, have no idea

artemyarulin09:12:43

Figured out why require(‘react-native’) doesn’t work. https://github.com/facebook/react-native/blob/6cec263ca3e006e05494ecc72ca0e1cc0230bbcc/packager/react-packager/src/DependencyResolver/Package.js#L16-L35 In short - packager finds all require(‘react-native’) calls and replace it with CurrPath + main attribute from react-native/package.json which as you can see https://github.com/facebook/react-native/blob/master/package.json#L32 equal to "main": "Libraries/react-native/react-native.js" When we download cljs files using figwheel and then eval it - we avoid packager and this replacement doesn’t occur

artemyarulin09:12:37

and boot_react_native should’t have this issue as it’s using native packager and custom transformer for JS files

johannjohann09:12:24

awesome deep dive

artemyarulin09:12:12

now I’m thinking that in a long run maybe we should drop figwheel and use boot_react_native with native packager instead

artemyarulin09:12:13

oh, we’ll loose nrepl then, no good

johannjohann09:12:22

yeah, it'd be a good idea to try to ride the coattails of the native packager

artemyarulin09:12:20

I’ll ask author about his thinking about nrepl support - if it’s possible we should go with native packager

johannjohann09:12:30

ouuu i wonder if this is the trick that would get sourcemaps working

johannjohann09:12:56

on first glance i think this has a cljs-repl doesnt it?

johannjohann09:12:02

the thing that i really like about the boot cljs dev setup versus figwheel

johannjohann09:12:17

is how composable the tasks are

johannjohann09:12:08

basically with this setup

johannjohann09:12:29

you run the task in the terminal, and it will start a repl that you can connect with through cider or fireplace or w/e

johannjohann09:12:22

i havent actually fired it up and checked if it works though

artemyarulin09:12:09

yeah - looks really interesting

artemyarulin09:12:31

although I think in a long run we should rewrite it for lein 😛

artemyarulin09:12:29

let’s see - I’ve created an issue for author. Oh, maybe he’s here?

artemyarulin09:12:06

@mjmeintjes Hey! We’ve been discussing your approach of working with react native at https://github.com/mjmeintjes/boot-react-native. Thanks for the project, but we wonder - does it support nrepl?

johannjohann21:12:13

another way to approach the interop is to use google closure compiler pass