I'm working with a basic ReactNative app using Emacs with Cider and ShadowCLJS. I can develop with the REPL pretty consistently but as soon as I accidentally save a file that has a syntax error in it then I lose communication to the REPL. Anything I type results in a delay followed by "REPL command timed out". The only way I have found to fix it is to restart the emulator with npx react-native run-android
. But then I lose all the state that I had in the REPL.
Often seeing "REPL command timed out" in Cider with shadow-cljs and React Native. Must restart emulator to fix
289 Views Asked by Eric Ihli At
1
This could be a number of different things.
It might related to the live-reloading that Metro (or Expo) provides. Press Ctrl-M (Cmd-M on Mac) in the emulator to bring up the options to turn off Fast Refresh.
https://facebook.github.io/react-native/docs/fast-refresh
https://github.com/thheller/shadow-cljs/issues/469
If you're still getting this error even after disabling Fast Refresh, it might be because ReactNative doesn't cleanly disconnect old websockets when reloading. Here's a comment from the creator of shadow-cljs.
I found a work-around using ReactNative's AppState and the reference to the websocket from the shadow-cljs dev namespace.
https://facebook.github.io/react-native/docs/appstate.html
https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/devtools/client/react_native.cljs