mfikes / ambly

ClojureScript REPL into embedded JavaScriptCore
http://ambly.fikesfarm.com
Eclipse Public License 1.0
541 stars 21 forks source link

Different context? or perhaps race condition #91

Closed invaliduser closed 9 years ago

invaliduser commented 9 years ago
  1. Follow the steps as outlined in ClojureScript React Native Quick Start
  2. Upon selecting "[1] AwesomeProject on iPhoneSimulator" at the REPL, Xcode logs a bunch of warnings (EDIT: normal), and the REPL is blind to variables it should be able to see:

    To quit, type: :cljs/quit cljs.user=> ((fn render [] (.requestAnimationFrame js/window render))) ReferenceError: Can't find variable: window cljs$user$render (NO_SOURCE_FILE) global code (NO_SOURCE_FILE)

I will keep investigating this and will report back if I figure it out. (This may be related to the Ubuntu race condition, but I'm running on OS X, so we'll see).

EDIT: markdown problems, will edit later (fun fact: the clojure [parameter] (body) syntax matches markdown's [link title] (link address) syntax)

mfikes commented 9 years ago

The warnings in Xcode are fairly normal. This may help: https://github.com/omcljs/ambly/wiki/Connectivity

invaliduser commented 9 years ago

All connected! Thanks.

mfikes commented 9 years ago

@invaliduser For #90, I've expanded the instructions that Ambly prints to detail how to eliminate the delayed upload to the WebDAV server https://github.com/omcljs/ambly/blob/master/Clojure/src/ambly/core.clj#L465

On OS X this issue doesn't occur. But you're revised description includes what appears to be ((fn render )) which is probably a typo, where the root problem is an inability to see js/window?

I tried just now in a fresh directory and the requestAnimationFrame bit worked for me:

cljs.user=> ((fn render []
  (.requestAnimationFrame js/window render)))
1
mfikes commented 9 years ago

@invaliduser Do you see the initial screen displaying "Welcome to React Native!" in the UI, prior to running the REPL?

invaliduser commented 9 years ago

The default one put in by the facebook team? Yes.

Something strange is going on here, though:

and the UI fails to respond to require statements (including clicking, as I was worried the workaround didn't work).

mfikes commented 9 years ago

Interesting. One idea is to flush out any residual state: Stop the iOS app in the simulator, and do iOS Simulator > Reset Content and Settings, and also look for any target and out directories that might be sitting in the same directory as your project.clj file, and look for any stale /Volumes/Ambly-* mount directories and remove them.

Then after this, fire up the app in Xcode, followed by connecting the REPL, to see if things work cleanly.

If not, perhaps you can share your code tree; I'd be interested in taking a look. You mentioned manually doing awesome-app.core at the REPL; perhaps there is a subtle issue when doing it that way.

Another thought that might be worth trying: There is a working app with startup instructions here https://github.com/mfikes/qttt#react-native-port that might be interesting for you to try to see if it fails in some interesting way that is specific to your environment (older Xcode or iOS simulators, etc.)

invaliduser commented 9 years ago

Narrative as I go:

So, all seems to be working. If I can reproduce I'll investigate more.

For reference: Xcode 6.3.1, iOS simulator 8.3 (SimulatorApp-565.9 CoreSimulator-117.15) [[org.clojure/clojure "1.7.0- RC1"] [org.clojure/clojurescript "0.0-3269"] [org.omcljs/om "0.8.8"] [org.omcljs/ambly "0.5.0"]]

mfikes commented 9 years ago

Cool!