cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
pez 2021-06-23T11:22:41.182800Z

The app freezes a few seconds after hot reload (shadow-cljs) on android, but not on ios. Anyone have even the faintest idea what could be going on, or what I can try do to isolate the problem?

pez 2021-06-24T11:37:03.196800Z

Now it doesn’t freeze on hot-reload.

pez 2021-06-24T11:39:33.197200Z

Jokes aside. I’ve narrowed it down to the require of our re-frame handlers namespace. But we make A LOT of requires there, and there are A LOT of handlers. I don’t think I will have all handlers in the same ns with the next app I build.

pez 2021-06-24T11:39:57.197400Z

I’m goin’ in again now. Cheers!

pez 2021-06-24T13:13:02.198400Z

I’m starting to suspect a circular dependency. That is just a hunch based on nothing, but anyway. I now have like a long thin drinking straw of namespaces requiring just one namespace 15 levels deep, I wonder how deep I will need to go before I hit bed rock. 😃

thheller 2021-06-24T13:21:05.198600Z

shadow-cljs won't compile circular dependencies. you'll get an error if you have one.

pez 2021-06-24T13:31:57.200100Z

Based on nothing. 😎 I have a feeling I will figure this out. Which is a great improvement from lately.

👍 1
pez 2021-06-23T11:39:18.182900Z

It doesn’t freeze if I reload using the REPL.

pez 2021-06-23T11:40:55.183100Z

The way it freezes is that I can still scroll the screens, but nothing else works. Touchables do not give any feedback, for instance.

pez 2021-06-23T11:43:13.183300Z

Debugger or no debugger, doesn’t make a difference.

thheller 2021-06-23T11:50:58.183500Z

does it freeze if your :dev/after-load does nothing? or does it only freeze when that does stuff (eg. re-render)?

thheller 2021-06-23T11:51:09.183700Z

might be something in your code causing an infinite loop or so?

pez 2021-06-23T12:03:24.183900Z

Now tried. It freezes also when I have

(defn render
  {:dev/after-load true}
  [])

pez 2021-06-23T12:04:56.184100Z

And even when I do stuff in that function. I can redefine things in the app and evaluate (render) to see the new definitions take effect. And then it does not freeze up.

thheller 2021-06-23T12:16:50.184300Z

do you have code that runs directly when loading the namespaces?

pez 2021-06-23T12:23:35.184600Z

I don’t think so…

pez 2021-06-23T12:35:47.184800Z

Don’t know if this is a clue, but at the same time this freeze happens I lose the REPL and also see this in the debugger: [React DevTools] Connection to RN closed

pez 2021-06-23T12:36:12.185Z

Maybe that’s consistent with the infinite loop hypothesis…

pez 2021-06-23T12:37:51.185200Z

How could it look like, running code directly when loading the namespaces? Top level evaluations?

thomas 2021-06-23T12:59:35.185400Z

things that are not in a function I think

pez 2021-06-23T13:17:33.185700Z

Well, I get the freeze even if shadow only compiles stuff that does only have def and defn things, and rich comments, top level.

pez 2021-06-23T13:18:15.186Z

Assuming that nothing is re-loaded that is not re-compiled.

pez 2021-06-23T13:26:34.186300Z

btw, @thomas it is the same kind of android-only freeze that I had in the project’s release builds before upgrading React Native and React Navigation. Now the release builds behave, but my android dev workflow is so broken…

thomas 2021-06-23T13:28:02.186500Z

hmm weird stuff going on here by the sounds of it.

pez 2021-06-23T13:32:14.186700Z

I have myself to blame a bit since I have avoided the Android emulator and mostly used iOS so didn’t notice when this weirdness started to happen.

raspasov 2021-06-23T14:32:30.186900Z

I would try commenting out everything and loading just one view with one button that shows an alert, for example. Keep tapping that. Does it freeze then? If it does not freeze, then comment back in component by component to see when the problem appears.

raspasov 2021-06-23T14:36:26.187100Z

Another random idea: does your Android app use Hermes by any chance? I haven’t used it, but David Nolen recently said that it caused weird problem for them.

pez 2021-06-23T14:54:05.187300Z

I had never heard of Hermes before reading that comment from Nolen. It’s disabled in build.gradle at least.

pez 2021-06-23T14:56:38.187500Z

Will probably do the commenting out everything thing. I’m totally out of any other idea.

👌 1
dnolen 2021-06-23T16:20:40.188100Z

@pez you haven't mentioned your Android setup - what version of Android etc.

pez 2021-06-23T16:37:12.196Z

Right. I should mention those things of course. I get this behaviour in the Emulator with some modern versions of Android as well as on my physical testing device which is a Samsung S5, with Android 6.0.1. A colleague has a very new phone which experienced the same “type” of freeze in a release build. I had the same on my test device. That freeze stopped to happen when I commented out a couple of SmoothenNextTransition uses, and also stops happening on a branch where I have those uses active, but have upgraded to latest RN and React Navigation 4. I mention this because I suspect that this dev-reload thing is the same problem, only triggered from a different path. Also, sometimes instead of this freeze, the app is just killed by the OS.