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 the app with fast-refresh disabled does not work #11463

Closed
jmurp opened this issue Apr 7, 2023 · 2 comments
Closed

Reloading the app with fast-refresh disabled does not work #11463

jmurp opened this issue Apr 7, 2023 · 2 comments
Labels
bug Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) no-recent-activity Issue/PR has gone stale and may be closed (label applied by bot) Scenario: Reload

Comments

@jmurp
Copy link

jmurp commented Apr 7, 2023

Problem Description

The immediate problem here is that when fast refresh is disabled, reloading the app causes it to close instead of reload. Then you have to run 'npx react-native run-windows' again to get it restarted.

I would appreciate help finding a way to make developing an app manageable in addition to the immediate issue being fixed from someone with a better understanding of react-native + metro + react-native-windows:

I am targeting react native windows using clojurescript which is compiled to javascript. I am new to react-native but have been using clojurescript + react for a while.

Note that in the starter project with fast-refresh enabled:

  • editing the contents of App.tsx will cause a fast-refresh
  • editing index.js will cause a message to appear saying that the app is reloading the bundle and takes a long time, much longer than an html refresh, I am unsure what is happening here.

I use clojurescript + shadow-cljs build tool to compile to ./app/index.js. It is from this file that the root component is registered. From the starter project's ./index.js, I import this file. Whenever the clojurescript is compiled to javascript (updating ./app/index.js), the app has to 'reload the bundle', so fast-refresh is not an option.

I noticed that the application will immediately and accurately update when app/index.js is changed even when fast-refresh is disabled... then it thinks it need to 'reload the bundle' and screws it up. So I thought that disabling fast-refresh would be the way to go and then I could manually reload the app whenever I needed a hard reload. This led me to the immediate issue I am reporting.

Steps To Reproduce

npx react-native init testProj --template react-native@^0.71.0
cd testProj
npx react-native-windows-init --overwrite --language cs
npx react-native run-windows
(open the developer menu and disable fast-refresh -- alternatively edit the App.xaml.cs ctor line InstanceSettings.UseFastRefresh = true to InstanceSettings.UseFastRefresh = false before building)
(press r in the metro terminal or press Reload App in the debugging tab)

Expected Results

the same thing that happens when you reload the app with fast-refresh enabled

CLI version

npx react-native -v
10.0.0

Environment

npx react-native info
System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 3800X 8-Core Processor
    Memory: 10.66 GB / 15.95 GB
  Binaries:
    Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.19041.0, 10.0.22000.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 17.4.33213.308 (Visual Studio Community 2022)
  Languages:
    Java: 17.0.6 - C:\Program Files\Eclipse Adoptium\jdk-17.0.6.10-hotspot\bin\javac.EXE
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.0 => 0.71.0
    react-native-windows: 0.71.4 => 0.71.4
  npmGlobalPackages:
    *react-native*: Not Found

Target Platform Version

None

Target Device(s)

Desktop

Visual Studio Version

2022

Build Configuration

None

Snack, code example, screenshot, or link to a repository

No response

@jmurp jmurp added the bug label Apr 7, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label Apr 7, 2023
@chrisglein
Copy link
Member

Note: When we add tests to cover fast refresh (#8609), the inverse should be covered (tests for when fast refresh is disabled). In our normal flow we don't generally disable fast refresh and then hit reload.

reloading the app causes it to close instead of reload

That sounds like the app crashed. Do you get anything in the logs for this from the bundler? And/or can you attach a debugger and get the callstack?

@chrisglein chrisglein added Scenario: Reload Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) and removed Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) labels Apr 10, 2023
@chrisglein chrisglein added this to the Backlog milestone Apr 10, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the no-recent-activity Issue/PR has gone stale and may be closed (label applied by bot) label Apr 21, 2023
@microsoft-github-policy-service
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) no-recent-activity Issue/PR has gone stale and may be closed (label applied by bot) Scenario: Reload
Projects
None yet
Development

No branches or pull requests

2 participants