Fork me on GitHub
#shadow-cljs
<
2023-02-09
>
dazld09:02:52

in react native, should shadow be refreshing code, or metro?

dazld09:02:30

it’s been a while since I’ve done any RN - last time was re-natal

dazld09:02:30

It’s doing this, and recreating shadow on every reload, it seems:

LOG  Running "Harvey" with {"rootTag":131,"initialProps":{}}
 LOG  shadow-cljs #77 ready!
 BUNDLE  ./index.js

 LOG  Running "Harvey" with {"rootTag":141,"initialProps":{}}
 LOG  shadow-cljs #78 ready!
 BUNDLE  ./index.js

 LOG  Running "Harvey" with {"rootTag":151,"initialProps":{}}
 LOG  shadow-cljs #79 ready!
 BUNDLE  ./index.js

 LOG  Running "Harvey" with {"rootTag":161,"initialProps":{}}
 LOG  shadow-cljs #80 ready!
 BUNDLE  ./index.js

 LOG  Running "Harvey" with {"rootTag":171,"initialProps":{}}
 LOG  shadow-cljs #81 ready!
 BUNDLE  ./index.js

 LOG  Running "Harvey" with {"rootTag":181,"initialProps":{}}
 LOG  shadow-cljs #82 ready!

dazld09:02:10

I tried disabling “fast refresh” in the debug menu, but seems like that turned everything off.

dazld09:02:21

perhaps this is a better question for #C0E1SN0NM too..

thheller09:02:16

you need to turn off any other reloading yes

👍 2
thheller09:02:29

> but seems like that turned everything off

thheller09:02:35

shouldn't affect what shadow does whatsoever?

Roman Liutikov09:02:57

Hey Dan 👋 Perhaps @UQP60F2B1 could help you 🙂

👋 2
dazld09:02:02

that’d be awesome, and hey 👋 back!

dazld09:02:34

the metro refresh clobbers all state in the app, so it’s pretty annoying. glad that this isn’t the intended experience.

dazld11:02:10

@U05224H0W perhaps the shadow live reloading isn’t working? could you suggest a way to debug that?

dazld11:02:08

I see the compilation success messages, and when metro has refreshed, the changes are visible. however, when “fast refresh” is disabled in RN, I don’t see any subsequent changes.

dazld11:02:43

repl connects fine too :I

thheller11:02:05

without knowing anything about what you are doing I can't really comment

dazld11:02:18

fair enough.

thheller11:02:33

ie. do you have the hooks configured? are you triggering your render properly?

thheller11:02:58

shadow just reloads your code. rendering it is up to you.

dazld11:02:30

yep, the hooks are there

dazld12:02:11

it’s definitely reloading, perhaps shadow.react-native/render-root isnt compatible with 0.71?

dazld12:02:45

I can see the modules being loaded, and can observe atoms changing in the namespace, but then nothing happens in the render

dazld12:02:21

@U05224H0W just a heads up, that there is indeed something not right with the render-root function, sadly - swapping to use the reload-comp strategy in https://github.com/flexsurfer/rn-shadow-steroid is working fine.

dazld12:02:48

if I get a chance later on, i’ll try and lock that down further.

thheller13:02:37

not aware of any issues, but I also don't use react-native so totally possible something doesn't work

dazld13:02:48

sorry for noise, appreciate the support. I’ll open an issue if i can get a reliable description of why the out of the box render fn wasn’t working here.