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

Reloading App not updating for the latest modified code RN 0.61x #27029

Closed
hugoh59 opened this issue Oct 28, 2019 · 68 comments
Closed

Reloading App not updating for the latest modified code RN 0.61x #27029

hugoh59 opened this issue Oct 28, 2019 · 68 comments
Labels
Needs: Author Feedback Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@hugoh59
Copy link

hugoh59 commented Oct 28, 2019

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.

@hugoh59 hugoh59 added the Bug label Oct 28, 2019
@react-native-bot
Copy link
Collaborator

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: Needs More Information labels Oct 28, 2019
@bockc
Copy link

bockc commented Oct 28, 2019

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
Copy link

mtnt commented Oct 29, 2019

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

UPD: I use Chrome devtools and this happens again...

@hugoh59
Copy link
Author

hugoh59 commented Oct 29, 2019

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.

@mtnt
Copy link

mtnt commented Oct 29, 2019

@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)

@bockc
Copy link

bockc commented Oct 29, 2019

Are you guys connecting to the Chrome debugger via localhost:8081/debugger-ui ? In my case there's absolutely no issue this way, but I don't really see why this would change anything ?

@mtnt
Copy link

mtnt commented Oct 30, 2019

And I don`t really see how good code that already worked ok and protected by package-lock and Podfile.lock could be broken without any updates...

@mtnt
Copy link

mtnt commented Oct 30, 2019

@hugoh59 @bockc is it works well now? It seems ok to me... and yes, I did not do anything to fix it

@hugoh59
Copy link
Author

hugoh59 commented Oct 30, 2019

@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.

@hugoh59
Copy link
Author

hugoh59 commented Oct 30, 2019

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

@hugoh59
Copy link
Author

hugoh59 commented Oct 30, 2019

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.

@bockc
Copy link

bockc commented Oct 30, 2019

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... :(

@hugoh59
Copy link
Author

hugoh59 commented Oct 30, 2019

@bockc Yes I did not have one either yesterday and this morning I had one, I'm really lost into what's going on I'm sorry I can't help any further... What I would do is kill everything and restart my computer but even that only works some of the times.

@bockc
Copy link

bockc commented Oct 30, 2019

@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
Copy link

mtnt commented Oct 31, 2019

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

@bockc
Copy link

bockc commented Oct 31, 2019

@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.

@mtnt
Copy link

mtnt commented Oct 31, 2019

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

@hugoh59
Copy link
Author

hugoh59 commented Nov 1, 2019

Same here...

@jwaldrip
Copy link

jwaldrip commented Nov 3, 2019

Having the same issue. This is extremely frustrating.

@ThiagoAlencar12
Copy link

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!

@brien-crean
Copy link

brien-crean commented Nov 7, 2019

Has anyone found a workaround so debugging can be enabled? As soon as I enable debugging old code is being loaded. I've tried all of the suggestions above.

Disabling debugging 'fixes' it but I need debugging enabled for some of the modules I use to work correctly. Such a frustrating issue!

@bockc
Copy link

bockc commented Nov 8, 2019

@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.

@brien-crean
Copy link

@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

@hugoh59
Copy link
Author

hugoh59 commented Nov 14, 2019

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

@bockc
Copy link

bockc commented Nov 15, 2019

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.

@hbarylskyi
Copy link

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

@viz21
Copy link

viz21 commented Apr 4, 2020

For me changing Debug server host & port for device in Dev settings to localhost:8081 worked

@matthiasleitner
Copy link

This is also happening for me using react-native 0.62.1, only restarting the packager allows to get changes reloaded.

@ridhoassuryadi
Copy link

solved when i tried

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

@medmo7
Copy link

medmo7 commented Apr 30, 2020

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

@mehmetaydar
Copy link

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.

@wandhi
Copy link

wandhi commented May 2, 2020

In my case I try to close React Native Debuger from my chrome and I re run my project and its work for me thanks

@johhansantana
Copy link

guys, somebody found the solution ! :D

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

@conradjonp
Copy link

conradjonp commented May 13, 2020

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.

@mechanizzed
Copy link

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 .

Thanks,

rm -rf .git/index.lock
works for me!

@Sbphillips19
Copy link

Sbphillips19 commented May 25, 2020

npx react-native-clean-project clean-project-auto

That will cause major issues to your project if you don't know what you are doing. Force updating all your module versions has major impacts.

As far as the issue, I have tried everything else mention. I am getting an has already been declared from me saving a reducer file with a statement I accidentally used twice. After removing I can't get rid of the error no matter how many times I use clean, rebuild, removing and reinstalling app, etc... I haven't touched the app for about 2 months, but had no issues 2 months abgo.

@medmo7
Copy link

medmo7 commented May 26, 2020

npx react-native-clean-project clean-project-auto

That will cause major issues to your project if you don't know what you are doing. Force updating all your module versions has major impacts.

As far as the issue, I have tried everything else mention. I am getting an has already been declared from me saving a reducer file with a statement I accidentally used twice. After removing I can't get rid of the error no matter how many times I use clean, rebuild, removing and reinstalling app, etc... I haven't touched the app for about 2 months, but had no issues 2 months abgo.

npx react-native-clean-project clean-project-auto gives options; you can say yes only to caches and ios/android build clean if you want. Thanks

@huseyin39
Copy link

Closing - Opening back the Node server worked for me.

@stale
Copy link

stale bot commented Aug 29, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 29, 2020
@stale
Copy link

stale bot commented Sep 5, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Sep 5, 2020
@hassan-irshad
Copy link

guys, somebody found the solution ! :D
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

@filipenatanael
Copy link

I was facing this issue few minutes ago, I managed to get it work by following the instructions below

  • Disable the firewall or adjust the permissions there
  • Run: adb kill-server && adb start-server
  • Run: adb -s YOUR_DEVICE_ID reverse tcp:8081 tcp:8081

Also, I tried rm -rf .git/index.lock but didn't help me on my especifically situation

@jbarnickol
Copy link

In case it helps someone - I've noticed if I have any javascript syntax errors, the app will launch the last working version (no new code) which can be very confusing. The errors are logged in the metro terminal session so I now watch for that when running new code.

@rui-ren
Copy link

rui-ren commented Nov 1, 2020

I got the same issue, and it was so annoying. Once I disable Debug module, it works perfect for me. Just disable the debug module in the developer menu, and it will be fast reloading when you save the file.

@saksham2410
Copy link

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

@cglacet
Copy link

cglacet commented Nov 27, 2020

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

@jakezegil
Copy link

If you made it this far, it's worth noting that hot reloading only works in the render method of a class component. This gave me a run for my money trying to figure out why my StackHavigator Header wasn't updating:
https://stackoverflow.com/a/49552575/12475345

@abduls30
Copy link

abduls30 commented Mar 5, 2021

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

@toni-trable
Copy link

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

@itsvishalcodes
Copy link

itsvishalcodes commented Mar 16, 2021

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

Same for me
Whenever I start the app in Virtual Device, it loads the Previous build. I have to manually build the app again using command 'react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res' everytime I have to make a change to the app for it to show but I don't want to do it everytime. It worked fine before.

@stgreenman
Copy link

Same for me except only for externally defined functions.

Workaround: Update logic or UI on a functional component. Metro for some reason rebuilds external functions then which is faster than rebuilding the entire project every time.

@lenis96
Copy link

lenis96 commented Jun 29, 2021

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 solved to me

@bartodt
Copy link

bartodt commented Sep 13, 2021

Any new solutions on this? These ones didnt work for me

@facebook facebook locked as resolved and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Author Feedback Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests