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

Let restart process continue when reload JS is not possible #602

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

kmagiera
Copy link
Member

@kmagiera kmagiera commented Oct 9, 2024

Changes from #477 broke restart flow for the cases when just reloading is not possible.

Previously, when "reload" button was clicked in the UI, we were trying to do the least invasive reload method possible. For that purpose we'd first attempt to reload JS, but only if the app process is alive. Apparently, due to the changes in #477 we were no longer checking whether app is running and we'd always call reload JS and let the restarting process end there.

This turns out to be a problem for example in scenarios where we get bundle error at the app startup. As a consequence, the app process never starts, and it is not possible to reload JS even once the bundle error we're getting gets fixed.

In this PR we're restoring this mechanism:

  1. we update reloadMetro method to forward the result from perform call which indicates whether the reload was successful.
  2. we check the result of reloadMetro call, and in case it returns false we let the restart process continue execution to eventually reach code that tries to restart the app process.

Test plan

  1. Simulate bundle error at startup (e.g., add broken import)
  2. Boot the app – see the error
  3. Fix the error and click reload (before this change it'd get stuck in "restarting" state, now it restarts the process)
  4. Later, use reloadJS when the app is loaded to make sure we don't restart the process.

Copy link

vercel bot commented Oct 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
radon-ide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 1:00pm

@kmagiera kmagiera merged commit eeac72c into main Oct 9, 2024
3 checks passed
@kmagiera kmagiera deleted the kmagiera/fix-reloads-after-bundle-error branch October 9, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants