Skip to content

Commit

Permalink
chore(fast-refresh): double check wasMounted (facebook#22740)
Browse files Browse the repository at this point in the history
  • Loading branch information
anc95 authored and zhengjitf committed Apr 15, 2022
1 parent aa5f0f6 commit ae876ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-refresh/src/ReactFreshRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,9 @@ export function injectIntoGlobalHook(globalObject: any): void {
if (alternate !== null) {
const wasMounted =
alternate.memoizedState != null &&
alternate.memoizedState.element != null;
alternate.memoizedState.element != null &&
mountedRoots.has(root);

const isMounted =
current.memoizedState != null &&
current.memoizedState.element != null;
Expand Down

0 comments on commit ae876ea

Please sign in to comment.