react-native: Reloading App not updating for the latest modified code RN 0.61x

System:
    OS: macOS Mojave 10.14.5
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 16.87 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

Since this morning, after not doing anything new to my project, the code suddenly stopped updating the view in my Xcode project. I have tried everything reseting the cache, reinstalling watchman, disabling fast refresh but nothing works. It seems as the project is no longer linked to the current version of my code somehow but keeps referring back to previous version.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 55
  • Comments: 68

Most upvoted comments

I’ve tried a lot of things including rm -rf .git/index.lock and now it works again, I’m not sure if that’s what solved it but try it out in case it ever comes back.

I’ve tried a lot of things including rm -rf .git/index.lock and now it works again, I’m not sure if that’s what solved it but try it out in case it ever comes back.

It take me a lot of time to solve. Just rm -rf .git/index.lock .

guys, somebody found the solution ! 😄

I can confirm that this worked for me using both the Chrome console and the react-native-debugger 😃

This worked for me after trying many other things. I simply needed to check the box in Chrome dev tools > Network > Disable cache

guys, somebody found the solution ! 😄

I can confirm that this worked for me using both the Chrome console and the react-native-debugger 😃

I have the exact same issue. The only state reloaded by RN is the state right after installing the app, any further change won’t be executed after a reload. Even by killing the app and starting it again, code modifications don’t apply… I hope there’s a fix for this coming soon, I don’t wanna redeploy my app from XCode everytime I change a single bit of code.

EDIT: @hugoh59 I just noticed that this occurs only when I enable debugging AND that I use react-native-debugger. Works fine without debugger or if you use the Chrome console. Looks like this is more related to react-native-debugger than react-native itself.

See this react-native-debugger issue

@mtnt try disabling remote debugging and enabling it again, works for me most of the time. Not ideal, but this is currently my best option while waiting for a fix from the team.

Closing - Opening back the Node server worked for me.

guys, somebody found the solution ! 😄

I can confirm that this worked for me using both the Chrome console and the react-native-debugger 😃

so it’s basically clearing the cache of the debugger tab… who would ever expect this to be the bug lol

@hugoh59 I started new project with RN 0.61.1 and It worked ok including debugging via Chrome console.log and debugger… until this morning - and I did not do anything too (just open my laptop and refresh the simulator)

I did - no results… It starts working ok while debug is disabled, and returns just on enabling debug

Having the same issue. This is extremely frustrating.

Well I just ran across this same issue right now using the chrome debugger this time. Had to kill the app and the debugger to actually reload my code. This is definitely an issue with the new react-native reload feature as no matter which debugger I use, this seems to occur randomly.

I’d also like some feedback from the team, just to know if they could quickly take a look at it.

@hugoh59 I don’t have any .git/index.lock nor .hg/index.lock 😕

EDIT: I confirm that as soon as I disable remote debugging my code gets updated. This issue makes RN kind of a pain to work with right now… 😦

What solved it for me npx react-native-clean-project clean-project-auto + new metro bundle + running a new build react-native run-ios

After that when i save the in vsCode i can see fast refresh blue banner again

I don’t use react-native-debugger but still has this issue since updating to RN 0.61x, what works for me is completely restarting my computer but that’s very time consuming.

Does someone know why .git/index.lock is causing this kind of issues?

Having the same problem on 0.63.3. Tried all the above changes

Sometimes when the debugger is connected, the browser caches the data. Try clearing the cache, kill the server and run it again. It worked for me 😃

On Mac: Run react-native for ios then, Go to

Simulator->Hardware->Erase all content and settings

Then go to Vscode,

Run without debugging

This made hot reload working for me.

Thanks @bockc ! In my case it happened as I updated a module (react-native-webview). As I installed the new version, the JS didn’t update anymore… When I disable debugging, it works again. But as soon as I enable it again, the old code is loaded… @react-native-bot is this enough informations?

Any help from the team would be appreciated. Not sure who to mention here.

I still get the issue but it goes away and comes back for no reason. It also happens when I disable fast refresh.

solved when i tried

  • rm -rf .git/index.lock
  • disabled remote debugginng and enabled it again

I’m not really sure if this really is what is causing the issue, but I noticed that when I got an exception in my code, I have the famous red screen and if I reload by saving my code after that, I will never be able to get the new code state, only the one that was before the exception crash. Once more, I’m not sure if that’s exactly what’s causing the issue.

still having the same issue with react-native: 0.63.4. I have tried all those changes but nothing

To see your updated changes, You have to restart your server

guys, somebody found the solution ! 😄 I can confirm that this worked for me using both the Chrome console and the react-native-debugger 😃

This worked for me after trying many other things. I simply needed to check the box in Chrome dev tools > Network > Disable cache

This Worked

I’ve tried every solution mentioned above and nothing worked for me. Also did a nuke (deleting pods, deleting node_modules, yarn run cache clean, etc…). Disabling debug and fast refresh didn’t work either. The code is still stale and I have to rebuild to get my code changes. I recently upgraded react-native on 0.61.

UPDATE: Found out that this only happens if I modify something related to the reducer (I am using redux). UI changes works, but for reducer code modifications, I am forced to rebuild.

UPDATE 2: For those who still can’t get this to work, reinstalling your xcode, deleting all your simulators, updating your Mac OS to the latest version and reinstalling xcode fixed this for me.

Does any one found the solution? I am not using debugger but still got the same problem. I’ve tried every solution that are mentioned above but problem remains same.

I’m forced to use XCode’s console window and attaching to the process. It’s kind of a workaround.

@bockc that unfortunately doesn’t work for me. This happens on android and ios for me. I ended up having to clone my project repo to a new location and that resolved it for now

@brien-crean Usually what I do when this occurs is I disable Debug, close my debugger, kill the app, press the start button in XCode and then I am fine for a few hours. Definitely not ideal, but I don’t have a better workaround right now.

My app in react native, i lost every time my states, i’m using hooks of react, useStates but, every time i update my app i lose my data, please help!

It`s here again! =) And I don`t have the .git/index.lock

@hugoh59 I still don’t have any of these files, so I guess the issue is deeper than a simple lock-file hidden in my project. I thought it could be some sort of cache, but I cleared every single cache related to my development environment and this has not changed anything. Also, my watchman is up to date (v 4.9.0_3). I literally have no clue where this could come from.

@mtnt I get the exact same issue. It’s incomprehensible. It happened to me during the day as well now. It’s like ghost code continue to live on even tho the code no longer exists, it still consol log things that I have erased and my code isn’t updated.

It’s super frustrating I’m wasting hours on looking where this could come from with not result so far. Any help from the team would be appreciated.