Skip to content

Commit

Permalink
[Flight] Instrument the Promise for Async Module instead of using a M…
Browse files Browse the repository at this point in the history
…odule Cache (#26985)

Currently, since we use a module cache for async modules, it doesn't
automatically get updated when the module registry gets updated (HMR).

This technique ensures that if Webpack replaces the module (HMR) then
we'll get the new Promise when we require it again.

This technique doesn't work for ESM and probably not Vite since ESM will
provide a new Promise each time you call `import()` but in the
Webpack/CJS approach this Promise is an entry in the module cache and
not a promise for the entry.

I tried to replicate the original issue in the fixture but it's tricky
to replicate because 1) we can't really use async modules the same way
without compiling both server and client 2) even then I'm not quite sure
how to repro the HMR issue.

DiffTrain build for commit 5945e06.
  • Loading branch information
sebmarkbage committed Jun 28, 2023
1 parent 161c5ae commit 0867ff0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23991,7 +23991,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-a1c62b8a7-20230627";
var ReactVersion = "18.3.0-canary-5945e068a-20230628";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8646,7 +8646,7 @@ var devToolsConfig$jscomp$inline_1036 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-a1c62b8a7-20230627",
version: "18.3.0-canary-5945e068a-20230628",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1238 = {
Expand Down Expand Up @@ -8677,7 +8677,7 @@ var internals$jscomp$inline_1238 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-a1c62b8a7-20230627"
reconcilerVersion: "18.3.0-canary-5945e068a-20230628"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1239 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9072,7 +9072,7 @@ var devToolsConfig$jscomp$inline_1078 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-a1c62b8a7-20230627",
version: "18.3.0-canary-5945e068a-20230628",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1279 = {
Expand Down Expand Up @@ -9103,7 +9103,7 @@ var internals$jscomp$inline_1279 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-a1c62b8a7-20230627"
reconcilerVersion: "18.3.0-canary-5945e068a-20230628"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1280 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-a1c62b8a7-20230627";
var ReactVersion = "18.3.0-canary-5945e068a-20230628";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,4 +623,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-canary-a1c62b8a7-20230627";
exports.version = "18.3.0-canary-5945e068a-20230628";
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-canary-a1c62b8a7-20230627";
exports.version = "18.3.0-canary-5945e068a-20230628";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a1c62b8a7635c0bc51e477ba5437df9be5a9e64f
5945e068abf1da4aec24aba2839abfbb0fe94a3d

0 comments on commit 0867ff0

Please sign in to comment.