Fork me on GitHub
#cljsrn
<
2015-11-07
>
mfikes02:11:39

It is really easy to cause the iOS simulator to display a white screen if you make an error in your ClojureScript code, and it appears to require a re-launch of the simulator to recover. I thought we used to always get red screens. Perhaps this is a new thing to be sorted out as it is s big pain point.

Oliver George03:11:32

Hi all, hi mike. Is there a link to this group on the cljsrn website. Might be useful.

mfikes04:11:46

@olivergeorge: I need to add a link. :)

Oliver George04:11:46

Can anyone recommend a technique to catch/log unhandled exceptions.

Oliver George04:11:57

We found that a fresh Natal setup will break if you put a println statement inside the render function on a fresh start. It seems to be that it causes an exception to be thrown but that exception cannot be seen anywhere (a try/catch handler allowed us to capture and render it in our test app).

Oliver George04:11:30

Cause seems to be that console.log wasn't yet ready. Bigger issue is having visibility of unhandled exceptions.

dvcrn06:11:56

oh cool, a react native channel simple_smile

Oliver George06:11:37

(Quick follow up. Once everything is loaded up exceptions are caught. I think our problem is mostly the first render happening before things are ready)

Oliver George08:11:05

(and again: Using .requestAnimationFrame(js/window, #(om/root ....)) works. Feels hacky but better than setTimeout)

mfikes12:11:31

@olivergeorge: The requestAnimstionFrame hack was the result of an offhand suggestion by Vjeux. I've added it as an item in http://cljsrn.org/roadmap.html FWIW

mfikes12:11:46

@olivergeorge: Oh I read your Natal ticket. Cool. Maybe that is a more robust approach.

anmonteiro14:11:17

@olivergeorge 's suggestion also solves my problem

anmonteiro14:11:01

@mfikes: not sure if you remember my problem last week; exactly regarding CLJS errors not triggering React Native's "red screen"

mfikes14:11:56

@anmonteiro: Cool! I wonder if it also plays into the white screen issue

anmonteiro14:11:41

what is the white screen issue?

anmonteiro14:11:58

the one that happens sometimes when reloading the app?

mfikes14:11:16

Currently, if you make an error, especially in IRender where, say, you mistype a fn name, the simulator displays a white screen, removing your previous UI. Then you have to relaunch.

anmonteiro14:11:46

I think we're talking about the same thing simple_smile

anmonteiro14:11:59

let me try to check that

mfikes14:11:36

Here is a demo of the “white screen” issue: https://youtu.be/fANy-QqGiI8

anmonteiro15:11:40

on what previously triggered the white screen

anmonteiro15:11:48

I'm now getting RN's red-screen

anmonteiro15:11:47

However: fixing the code doesn't seem to get us out of the red screen

anmonteiro15:11:57

which is still a show-stopper

anmonteiro15:11:45

I've added my comments to the Natal GitHub issue

mfikes15:11:49

@anmonteiro: what if you dismiss the red screen

anmonteiro15:11:17

oh I should learn to read

anmonteiro15:11:23

trying that atm

mfikes15:11:37

Cool. Thanks for the snippet. I can try too.

anmonteiro15:11:02

dismissing the red screen gets us the dreadful white screen

anmonteiro15:11:40

do you have any idea why?

anmonteiro15:11:50

it would make more sense to me if it was the predefined class in index.ios.js

anmonteiro15:11:02

and probably easier to solve too

mfikes15:11:05

Maybe it would be possible to reload in the simulator if it involved index.ios.js in some way.

mfikes15:11:14

You can see interesting stack traces if you try to call (om/root widget app-state {:target 1}) after getting a white screen. https://gist.github.com/mfikes/2d9a0d75c8c8ab18f0e2

anmonteiro15:11:53

it seems the React instance is not there anymore

anmonteiro15:11:57

hence the null`