React-native: Running Debug runs a previous cached version of code

Created on 14 Nov 2019  路  5Comments  路  Source: facebook/react-native

Using a simulator or physical device on "Debug" mode, the app is running a previous cached version of the code being ran. If i was to change

<Text style={styles.buttonTitle}>Monthly</Text>

to

<Text style={styles.buttonTitle}>Yearly</Text>

The app shows "Monthly" rather then the updated version of "Yearly".

After clicking "Stop Debugging" the app then shows the "Yearly" version, but when i go back to Debug the app will once again show "Monthly"

React Native version:
System:
OS: macOS 10.15.1
CPU: (8) x64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
Memory: 1.95 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.15.1 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.2/11B52 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: ^0.61.4 => 0.61.4
npmGlobalPackages:
react-native-cli: 2.0.1

Steps To Reproduce

  1. Run app on Debug, and change values / actions etc.
  2. App values won't change
  3. Turn off Debug, and the values will have changed
  4. Turn on Debug, values will go back to previous values

Describe what you expected to happen:

I expect that when i change the values in my code, while in Debug mode, the app updates along with the code.

Bug

Most helpful comment

Got same issue a couple of times on simulator.
Tried restarting Metro Bundler, run on different simulators. Still keep running cached code when Debug enabled.
It gets fixed after some time, don't know how.

Using react-native: 0.61.1

All 5 comments

For anybody else who has this issue, I think the reason was because my physical device was not on the same Wifi as my computer.

Got same issue a couple of times on simulator.
Tried restarting Metro Bundler, run on different simulators. Still keep running cached code when Debug enabled.
It gets fixed after some time, don't know how.

Using react-native: 0.61.1

yeah same issue here too,

even with this clean script, clean ios build and rebuild.

watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && yarn cache clean && yarn && yarn start -- --reset-cache

Same issue here

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josev55 picture josev55  路  3Comments

axelg12 picture axelg12  路  3Comments

phongyewtong picture phongyewtong  路  3Comments

jlongster picture jlongster  路  3Comments

ghost picture ghost  路  3Comments