Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native-debugger causes app to load stale JS code #423

Closed
rikur opened this issue Oct 25, 2019 · 46 comments
Closed

react-native-debugger causes app to load stale JS code #423

rikur opened this issue Oct 25, 2019 · 46 comments

Comments

@rikur
Copy link

rikur commented Oct 25, 2019

React Native Debugger app version: 0.10.2
React Native version: 0.61.2
Platform: iOS
Is real device of platform: No
Operating System: macOS 10.14.6

When I enable Debug from the developer menu and connect through react-native-debugger, my app is stuck on an old, stale version of the JS code and editing files and reloading doesn't pick up any changes either. Debugging via the usual debugging tab in Chrome doesn't have this issue.

@bockc
Copy link

bockc commented Oct 28, 2019

I can confirm that this issue occurs and stays there even if you kill the app and restart it as the debugging option stays enabled, so this is definitely not an issue with the new react-native fast-reload feature.

@mtnt
Copy link

mtnt commented Oct 29, 2019

this is definitely not an issue with the new react-native fast-reload feature

Live reload still updates code (with the debugger turned on).

@bockc
Copy link

bockc commented Oct 29, 2019

@mtnt In my case, nothing works as soon as react-native-debugger is connected. Even adding // @refresh reset didn't change anything. I'm using RN0.61 (just like the author), so there's no option anymore to enable only live reload, and this is the first RN version in which this issue occurs for me. Which RN version do you use ?

@mtnt
Copy link

mtnt commented Oct 29, 2019

@bockc 0.61.1

@bockc
Copy link

bockc commented Oct 30, 2019

How can you choose to use live-reload specifically instead of the new fast-refresh feature ?

@martinezguillaume
Copy link

martinezguillaume commented Oct 31, 2019

same problem here ! I need to uninstall completely the app to make it work again, but this problem can reappear at any time...

@rikur
Copy link
Author

rikur commented Nov 14, 2019

@jhen0409 any idea what could becausing this? Maybe Fast Refresh? I love this tool but now it's useless :/

@JacobJaffe
Copy link

JacobJaffe commented Nov 14, 2019

Also facing this issue,
React Native Debugger app version: 0.10.2
React Native version: 0.61.2
Platform: iOS
Is real device of platform: No
Operating System: macOS 10.14.3

In addition, upon saving files for fast refresh, I get the following error:

Error: Requiring unknown module "470". If you are sure the module exists, try restarting Metro. You may also want to run `yarn` or `npm install`.

(only with React Native Debugger)

@toby-pondr
Copy link

This is happening to me as well. As soon as I start debugging, it reverts back to a previous version. With debugging off, it works fine. Fast refresh works with debugging off.

react-native: 0.61.2
Android
Mac OS 10.15

@fendorio
Copy link

Happening for me too, stale code served with debugger connected.

react-native: 0.61.3
iOS
Max OS: 10.14.6

@dquessenberry
Copy link

I am having the same issue with v0.10.4. It took me nearly 2 hours to figure out what is causing it - I thought I was going mad! Does anyone have any work arounds? I already downgraded this tool once recently because it was freezing and I was forced to restart it about 5 times a day. Decided to upgrade hoping my previous issue was fixed, but it looks like there is an even more serious bug now, so for now it back to v0.9.14...

RN: 0.61.2
iOS
MacOS: 10.14.6

@bockc
Copy link

bockc commented Nov 19, 2019

@dquessenberry this is not an issue with react-native-debugger, this is an issue with react-native itself and its new fast refresh feature. By using the chrome console as a debugger I encounter the same issue. There's nothing much to do right now but to wait for the react-native team to fix this

@dquessenberry
Copy link

dquessenberry commented Nov 19, 2019

@bockc hmmm, I don't seem to be encountering the issue via Chrome console. What is especially odd is if RND is connected it loads stale js, if disconnected it shows the latest code, however if I completely uninstall RND and then reinstall it, it still shows stale code. So with that said, I suppose you're correct, it must be something outside of RND, such as RN itself. Thanks.

EDIT: I just downgraded RND to v0.9.14 and I no longer experience this issue. I'm not saying that the bug is entirely RND, but perhaps there is some issue with a combination of RND v0.10.4 and RN's fast refresh feature.

For those interested in downgrading RND to the last major release, v0.9.14, run the following commands:

brew cask uninstall react-native-debugger
brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/f6db4e3e6c2a773bc2967db5819118299b8a60a1/Casks/react-native-debugger.rb

@bockc
Copy link

bockc commented Nov 20, 2019

Well, that's nice to hear for you, glad that you could find a way out of this.
But I guess this issue will reappear sooner or later for you, I sometimes have a whole day where this does not happen, and the following day everything starts to go rogue...
Anyway, I hope for you that you're definitely out of it :)

I don't think the issue comes from a combination of RND and RN either, as I tried with both Chrome and RND, this issue is exactly the same. The only common thing I see between all I have tested is... RN itself haha, but of course I could be missing something

@dyancat
Copy link

dyancat commented Nov 25, 2019

image

What worked for me is disabling the cache in the network tab

@martinezguillaume
Copy link

For me, when this happens, I'm using a software (CleanMyMac) to clean React Native Debugger files. Then, restart it and works again !

image

@lafiosca
Copy link

lafiosca commented Nov 25, 2019

Today was the first time I ran into this problem, coincidentally right after doing a self-update of React Native Debugger to 0.10.5. I'm not certain which version of RND I upgraded from, but it was at least 0.10.2 and likely 0.10.4. This is a RN 0.61.4 app. @dyancat 's suggestion of disabling the network cache worked for me, which leads me to assume that the development build of my app was fetching a cached version of the bundle. This seems reinforced by the fact that the only network fetch in the log window is for http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false.

I had previously tried deleting the watchman cache, upgrading watchman, resetting the metro cache (multiple times), deleting my entire repo and reinstalling it, rebuilding the app, etc. The only consistent behavior was that each time I turned on debugging, the old version of the app loaded.

After turning on debugging again, disabling network cache in React Native Debugger, and hitting reload on the app, the latest version of my app code loaded. Re-enabling the cache after that and reloading again still showed the latest version.

@bockc
Copy link

bockc commented Nov 25, 2019

I confirm that disabling the network cache prevents the issue from occurring. It didn't work for me because I didn't restart react-native-debugger after disabling the network cache.

@irondsd
Copy link

irondsd commented Dec 11, 2019

image

What worked for me is disabling the cache in the network tab

I was so confused and it took me an hour to figure out it was a debugger's fault. This worked great. Thank you, sir

@KingAmo
Copy link

KingAmo commented Dec 24, 2019

i suggest pin this issue before it is resolved. i have spend hours before come here

@terence612
Copy link

I should have search this issue earlier. This solution solved my problem.

image

What worked for me is disabling the cache in the network tab

@vinhdothe93
Copy link

image

What worked for me is disabling the cache in the network tab

Thanks so much. You saved my life. :D

@rikur
Copy link
Author

rikur commented Mar 22, 2020

Alright, I think we can close this issue. Thanks @dyancat!

@rikur rikur closed this as completed Mar 22, 2020
@infostreams
Copy link

@rikur What do you mean close it? That's not a solution, that's a workaround! Can you make changes in the debugger so that it never loads stale Javascript code? This bug has caused me multiple hours TWICE! And I'm sure I'm not the only one. The problem described in this ticket is not resolved.

@rikur rikur reopened this Mar 31, 2020
@infostreams
Copy link

Thanks for re-opening it. Is it possible that this https://stackoverflow.com/a/55026131 is the solution for this problem?

jhen0409 added a commit that referenced this issue Apr 8, 2020
@mjgul
Copy link

mjgul commented Apr 8, 2020

the app runs old code since the evening I don't know why this is happening?

@cryptedx
Copy link

cryptedx commented Apr 9, 2020

the app runs old code since the evening I don't know why this is happening?

Disable the cache like mentioned above.

@chudaotrucnhan
Copy link

image

What worked for me is disabling the cache in the network tab

You saved my life :D

@eurobob
Copy link

eurobob commented Apr 25, 2020

This is so fucking dumb. Yesterday no problem, today I had the issue. Wtf. Thanks for the fix @dyancat

@kbrandwijk
Copy link

kbrandwijk commented Apr 29, 2020

Never happened to me before, but started happening in 0.11.0-beta-4.

Fixed in 0.11.1 indeed :D

@mertuner
Copy link

mertuner commented May 3, 2020

image

What worked for me is disabling the cache in the network tab

Thank you good sir

@Ben-Mark
Copy link

Ben-Mark commented Jun 1, 2020

The react native debugger must set that checkbox by default!

Thank you @dyancat !!

@darkbasic
Copy link

The react native debugger must set that checkbox by default!

It does. Make sure to not use outdated versions.

@Ben-Mark
Copy link

Ben-Mark commented Jun 1, 2020

I'm on RN 0.62.2

@darkbasic
Copy link

darkbasic commented Jun 1, 2020

I'm on RN 0.62.2

RN version doesn't matter, it's the RN Debugger that you have to upgrade.

@BrunoVillanova
Copy link

image

What worked for me is disabling the cache in the network tab

Thank you so much!!!

@seanlangley
Copy link

image

What worked for me is disabling the cache in the network tab

Thank you so much, I spent an hour on this problem and this fix worked for me.

@FuzzyBuckBeak
Copy link

image

What worked for me is disabling the cache in the network tab

I spent hours on this before i ended up here. Thanks @dyancat

@SethArchambault
Copy link

Ah this explains why I was only encountering this in the native debugger - on the web I commonly use the Disable Cache feature to test website page reloads, so that was already checked.. Thanks!

@AndrewEastwood
Copy link

The disabling cache feature does not work for me

@renwenci
Copy link

i met this problem after a git.lock generated, delete it, and every thing is ok

@Roselai
Copy link

Roselai commented Sep 3, 2020

Today was the first time I ran into this problem, coincidentally right after doing a self-update of React Native Debugger to 0.10.5. I'm not certain which version of RND I upgraded from, but it was at least 0.10.2 and likely 0.10.4. This is a RN 0.61.4 app. @dyancat 's suggestion of disabling the network cache worked for me, which leads me to assume that the development build of my app was fetching a cached version of the bundle. This seems reinforced by the fact that the only network fetch in the log window is for http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false.

I had previously tried deleting the watchman cache, upgrading watchman, resetting the metro cache (multiple times), deleting my entire repo and reinstalling it, rebuilding the app, etc. The only consistent behavior was that each time I turned on debugging, the old version of the app loaded.

After turning on debugging again, disabling network cache in React Native Debugger, and hitting reload on the app, the latest version of my app code loaded. Re-enabling the cache after that and reloading again still showed the latest version.

Thank you! This worked for me.

@rusakovic
Copy link

Disable cache not solve this issue

@gaberogan
Copy link

@jhen0409 Why is this still closed? Do we need to open another issue?

cryptodev523 pushed a commit to cryptodev523/react-native-debugger that referenced this issue Jan 27, 2022
cryptodev523 pushed a commit to cryptodev523/react-native-debugger that referenced this issue Jan 27, 2022
@daihieptn97
Copy link

Try deleting the

  • ./android/.idea folders.
  • ./android/.gradle folders.

It works for me

enter image description here

@ajaymarathe
Copy link

image

What worked for me is disabling the cache in the network tab

yeah, it's working now, thanks everybody 👍🏻 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests