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

[BUG]: Silently fails with multiple exports #426

Closed
jaidetree opened this issue Jun 11, 2021 · 2 comments
Closed

[BUG]: Silently fails with multiple exports #426

jaidetree opened this issue Jun 11, 2021 · 2 comments

Comments

@jaidetree
Copy link

jaidetree commented Jun 11, 2021

Just spent about 6 hours trying to understand why my component is not reloading (or refreshing) only to find it’s because I have multiple exports.

Problem

I understand that this library may never support files with multiple exports, but in my experience it’s a pretty common pattern to export an atom, a util function or two related to a component, a constant, or multiple components.

More importantly, the app was not reloading and not refreshing, and no information was available to help me understand fast-refresh expected only a single component export and that it would even try to fallback to hard-refresh.

Reproduction

https://github.com/eccentric-j/cra-reload-repro

  1. Run npx create-react-app reload
  2. Run yarn start
  3. Open the page in your browser
  4. Change content in App.js
  5. Look at the page again in browser

Expected

Ideally it would be intelligent enough to see the code is not performing any side-effects against the non-react export and apply the update. 🙂

Given that the intention is to ensure safety and since it doesn’t know if any side-effects are caused, it therefore will not apply any updates then I expect it to hard-refresh the page.

If it can’t apply the updates then I expect to see some logging info that fast-refresh could not apply the update and is hard-refreshing. Ideally if it can’t hard-refresh, maybe some insight about that so one knows where to begin looking.

Actual

Changing App.js does not apply the updates and it also does NOT hard-refresh. The network tab indicates the WebSocket data was received so it is not a seemingly a plumbing issue.

Environment

Reproduced on Safari and Brave.

@pmmmwh
Copy link
Owner

pmmmwh commented Jun 15, 2021

See facebook/create-react-app#11105 - this is an issue upstream.

@pmmmwh pmmmwh closed this as completed Jun 15, 2021
@jaidetree
Copy link
Author

Thanks for your work @pmmmwh it’s really appreciated 🙂

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

No branches or pull requests

2 participants