This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-27
Channels
- # admin-announcements (9)
- # aws (1)
- # beginners (4)
- # boot (197)
- # cider (38)
- # cljsrn (70)
- # clojure (128)
- # clojure-russia (36)
- # clojurecup (1)
- # clojurescript (86)
- # core-typed (2)
- # css (1)
- # datomic (35)
- # editors-rus (4)
- # hoplon (22)
- # ldnclj (2)
- # mount (19)
- # off-topic (45)
- # om (63)
- # onyx (7)
- # parinfer (8)
- # yada (2)
interesting alternate take on react native <-> cljs interop https://github.com/mjmeintjes/boot-react-native/blob/master/src/mattsum/boot_react_native.clj
Ha, cool idea. Added to the watch list
have you poked around with how http caching works on android/ios within react native @artemyarulin ?
or are you fetching stuff natively?
Yeap, I’m using XmlHttpRequest wrapper (fetch is just a wrapper around it). Under the hood it uses standard iOS cache staff
do you have any problems with it?
no not yet just have been dancing around looking for its defaults
Usual issue there that http GET is cached by default
i was thinking of trying to have a ETag on the remotes endpoint
that hashes the query
then have the client cache be responsible for remembering the last hashed query and maybe a last-modified
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
hmm yeah great point
should look into what guarantees i get for the lifetime of the cache lol what a mess
the dream was to push the statefulness to the edges and leave me with less to keep track of
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
I guess in your case the easiest way to save Etag and hash somewhere on a disk
yeah so im playing around with datascript
maybe i can store the hash of the query in the transaction
another question i had--have you done anything with nested navigators
not yet
btw - are working with android or ios version?
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: '' }
have yet to play around with the latest figwheel setup on android but i will keep a lookout !!!
are you catching all errors in the debugger?
might be helpful to get more useful info
Well when I enable Chrome debugger this error goes away
dude thats hilarious
(and horrifying lol)
ending is nice
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
interesting
maybe its a race condition
maybe
The thing I don’t understand why the hell js/require “react-native”
doesn’t work
it always gives Required unknown module
looks like packages has a different handling of this root namepsace, as I can pretty much require anything else like js/require “TextInput”
do you have to type out the full path or something?
yeah - I know that it works with full path
It should work without it
wasnt sure if that covered it
another thing i was mulling over
is it possible to get source maps working when the code is being executed in workers?
hm, have no idea
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
and boot_react_native should’t have this issue as it’s using native packager and custom transformer for JS files
awesome deep dive
now I’m thinking that in a long run maybe we should drop figwheel and use boot_react_native with native packager instead
oh, we’ll loose nrepl then, no good
yeah, it'd be a good idea to try to ride the coattails of the native packager
I’ll ask author about his thinking about nrepl support - if it’s possible we should go with native packager
ouuu i wonder if this is the trick that would get sourcemaps working
on first glance i think this has a cljs-repl doesnt it?
dang this is interesting also https://github.com/mjmeintjes/boot-react-native/blob/master/resources/mattsum/boot_rn/js/goog_base.js
the thing that i really like about the boot cljs dev setup versus figwheel
is how composable the tasks are
basically with this setup
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
i havent actually fired it up and checked if it works though
yeah - looks really interesting
although I think in a long run we should rewrite it for lein 😛
let’s see - I’ve created an issue for author. Oh, maybe he’s here?
@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?
another way to approach the interop is to use google closure compiler pass