Fork me on GitHub
#cljsrn
<
2022-02-11
>
bringe22:02:23

Has anyone else experienced an issue with hot reloading while using Expo + shadow-cljs? I don’t know yet if the issue is caused by Expo or by React Native / Metro itself. I can reproduce the issue with https://github.com/PEZ/rn-rf-shadow. With Fast Refresh disabled (supposedly), if I make a change in app.cljs and save the file, the app is reloaded (so state is lost), and the version of the code seems to be from before the change I made.

bringe22:02:18

Here’s a video of the issue.

bringe22:02:59

If I enable then disable fast refresh, the issue seems to go away, but in my experience it comes back later.

bringe22:02:09

"shadow-cljs": "^2.17.1"
"expo-cli": "^5.1.2", // upgraded from the linked repo, but the issue happens with the version in the repo as well

UlisesMAC07:02:59

Hi @U9A1RLFNV That is expected to happen. When you enable fast refresh (that is the refresh managed by expo), all the app is recompiled, making the state to be lost. Are you using the last version of rn-rf-shadow's repo? There is a file called webpack.config that disables the calls to fast refresh from code, also you need to disable fast refresh from the app. At least that is what I did, also when my app growth, I had to configure which files/functions needed to be recompiled by shadow-cljs (using :dev-after-load metadata) to keep a good development experience using hot reload.

bringe16:02:41

Yes, I’m aware of fast refresh and do run with it disabled, and still experience this issue. If I enable then disable it when the issue is happening, it sometimes fixes it for a bit, but it starts reloading again eventually it seems (and if I do a manual reload of the app). This happens with fast refresh disabled. I was using the latest version of rn-rf-shadow in that video, and fast refresh was disabled. @U0ETXRFEW (author of that repo) has noted that he also experiences this issue and doesn’t yet know the cause.

bringe16:02:20

> There is a file called `webpack.config` that disables the calls to fast refresh from code, also you need to disable fast refresh from the app. Hmm, I haven’t looked there for a solution yet, so that’s another option. Thanks.