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 application does not update on many code changes when using vim #1211
Comments
Hi @antun - thanks for reporting. Something’s clearly wrong there but it’s hard to tell exactly where, since there are a few steps between a file event being detected and the app rendering updated modules (not all of them in Metro). Just to clarify, when you hit Could you possibly run a similar video starting Metro with |
Hi @robhogan , thanks for reviewing this so quickly! Here's an updated video in debug mode: react_native_not_updating_debug.movIn this video, only the very first change to code was captured (about 0:22 in the video). When I hit Observations: When a change is captured correctly, and the app updates, this is the output:
When I save, and nothing happens, this is the output:
I noticed it mentions an |
UPDATE I did a bit more digging and found that with vim (editor) the default behavior is to write the buffer to a new file (I'm guessing this is If I set It sounds like it's not recommended to leave |
Interesting, thanks! It looks like from Metro's perspective Watchman reports a "new file" event for If Watchman sees the file as new it's odd that there's no prior, corresponding deletion event - Metro would treat delete+add the same as modified. I'll raise this with Watchman folks, but in any case we can change our assumptions here to treat added as possibly-modified, and the vim repro will help us verify, so thanks again. I'll leave this open until we've landed some way to support this editor behaviour. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Newly-created React Native app doesn't reflect every code change during development when using Metro. The behavior is intermittent. Some code changes will be reflected in the app, then some won't be after saving the file. None of the following work to "force" an update:
--reset-cache
.It looks minor, but it's really disruptive to development, since when I'm debugging, I can't tell which version of the app is currently being displayed. The only "workaround" I have is to add unique
console.log()
statements until one of them appears in the terminal that matches what I last wrote.Usually the first code change is reflected after starting Metro. After that it's totally it or miss. I might get two or three successful updates in a row, and then none for a while.
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can
yarn install
andyarn test
.npx react-native@latest init react_native_update_test
npx react-native run-android
. (Although I see the same behavior with iOS.)In the attached video, you can see:
react_native_not_updating.mov
What is the expected behavior?
I presume that the app should update on every code change.
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
Node v18.19.0
watchman 2023.12.04.00
Mac OS 14.2.1 (23C71)
metro@0.80.5
The metro config is the standard one for a new React Native app:
The text was updated successfully, but these errors were encountered: