GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Track late-mounted roots in Fast Refresh by anc95 · Pull Request #22740 · react/react

Conversation

@anc95

@anc95 anc95 commented Nov 11, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

In doing the micro front-end sub-application encountered the problem of sub-application hot update does not work, I debugged it like this

  1. use the online (test environment) main application address
  2. proxy the sub-application to be debugged to localhost (localhost domain)

In order to keep the Shared React Context, our sub-application is loaded by the main application as a React component, because react-refresh is loaded only when the sub-application is executed, so the current root is not properly collected in the mountedRoots, and eventually the hot update of the application does not work.

How did you test this change?

When determining wasMounted, adjust to

const wasMounted =
            alternate.memoizedState != null &&
            alternate.memoizedState.element != null &&
            mountedRoots.has(root);

Logically, there is no breaking change here, and it solves my problem perfectly
demo

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@anc95
chore(fast-refresh): double check wasMounted
56146f8
@facebook-github-bot

facebook-github-bot commented Nov 11, 2021

Copy link
Copy Markdown
Contributor

Hi @anc95!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sizebot

sizebot commented Nov 11, 2021

Copy link
Copy Markdown

Comparing: e0aa5e2...56146f8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 129.68 kB 129.68 kB = 41.46 kB 41.46 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 134.66 kB 134.66 kB = 42.94 kB 42.94 kB
facebook-www/ReactDOM-prod.classic.js = 424.11 kB 424.11 kB = 78.18 kB 78.18 kB
facebook-www/ReactDOM-prod.modern.js = 412.66 kB 412.66 kB = 76.43 kB 76.43 kB
facebook-www/ReactDOMForked-prod.classic.js = 424.11 kB 424.11 kB = 78.18 kB 78.18 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 56146f8

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@facebook-github-bot facebook-github-bot added the CLA Signed label Nov 11, 2021
@facebook-github-bot

facebook-github-bot commented Nov 11, 2021

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gaearon gaearon changed the title chore(fast-refresh): double check wasMounted Track late-mounted roots in Fast Refresh Nov 18, 2021
@gaearon
gaearon merged commit b831aec into react:main Nov 18, 2021
@gaearon

gaearon commented Nov 18, 2021

Copy link
Copy Markdown
Collaborator

thanks!

JohnRoseDev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

facebook-github-bot pushed a commit to react/react-native that referenced this pull request Nov 29, 2021
Andrei Shikov @facebook-github-bot
React Native sync for revisions c0c71a8...c1220eb
a596e98
Summary:
This sync includes the following changes:
- **[c1220eb](react/react@c1220ebdd )**: treat empty string as null ([#22807](react/react#22807)) //<salazarm>//
- **[09d9b17](react/react@09d9b1775 )**: Update deprecated features in ESLint configuration files. ([#22767](react/react#22767)) //<Esteban>//
- **[bddbfb8](react/react@bddbfb86d )**: Revert "Fix Node package.json ./ exports deprecation warning ([#22783](react/react#22783))" ([#22792](react/react#22792)) //<Sebastian Silbermann>//
- **[b831aec](react/react@b831aec48 )**: chore(fast-refresh): double check wasMounted ([#22740](react/react#22740)) //<anc95>//
- **[8edeb78](react/react@8edeb787b )**: Fix Node package.json ./ exports deprecation warning ([#22783](react/react#22783)) //<Rin Arakaki>//
- **[fdc1d61](react/react@fdc1d617a )**: Flag for client render fallback behavior on hydration mismatch ([#22787](react/react#22787)) //<salazarm>//
- **[aa19d56](react/react@aa19d569b )**: Add test selectors to experimental build ([#22760](react/react#22760)) //<Brian Vaughn>//
- **[520ffc7](react/react@520ffc77a )**: Use globalThis if possible for native fetch in browser build ([#22777](react/react#22777)) //<Jiachi Liu>//
- **[afbc2d0](react/react@afbc2d08f )**: Remove unused react-internal/invariant-args ESLint rule. ([#22778](react/react#22778)) //<Esteban>//
- **[ca94e26](react/react@ca94e2680 )**: Remove 'packages/shared/invariant.js' ([#22779](react/react#22779)) //<Esteban>//
- **[8356471](react/react@83564712b )**: Move SuspenseList to experimental channel ([#22765](react/react#22765)) //<Andrew Clark>//
- **[d4144e6](react/react@d4144e6e5 )**: fix : grammatical typo for test description ([#22764](react/react#22764)) //<Brijesh Prasad>//
- **[0b32951](react/react@0b329511b )**: chore: fix comment typo ([#22657](react/react#22657)) //<Han Han>//
- **[e6f60d2](react/react@e6f60d2ad )**: fix typos ([#22715](react/react#22715)) //<180909>//

Changelog:
[General][Changed] - React Native sync for revisions c0c71a8...c1220eb

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32646433

fbshipit-source-id: c534ee7a17141634700c90fc2c7b34bfbe17887a
@benjamingr

benjamingr commented Dec 26, 2021

Copy link
Copy Markdown

We just ran into this bug, super cool to see this was worked on, cheers!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gaearon gaearon mentioned this pull request Mar 29, 2022
Add React 18 changelog #24195
Merged
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
@anc95 @zhengjitf
chore(fast-refresh): double check wasMounted (react#22740)
ae876ea
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@anc95
chore(fast-refresh): double check wasMounted (react#22740)
3af3eb0
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@anc95
chore(fast-refresh): double check wasMounted (react#22740)
47241f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@anc95 @facebook-github-bot @sizebot @gaearon @benjamingr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.