Skip to content

Commit 0b54e00

Browse files
authored
Handle rejections to avoid uncaught rejections (#25272)
1 parent c5d06fd commit 0b54e00

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-server-dom-webpack/src/ReactFlightClientWebpackBundlerConfig.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export function resolveModuleReference<T>(
5858
const chunkCache: Map<string, null | Promise<any>> = new Map();
5959
const asyncModuleCache: Map<string, Thenable<any>> = new Map();
6060

61+
function ignoreReject() {
62+
// We rely on rejected promises to be handled by another listener.
63+
}
6164
// Start preloading the modules since we might need them soon.
6265
// This function doesn't suspend.
6366
export function preloadModule<T>(
@@ -72,7 +75,7 @@ export function preloadModule<T>(
7275
const thenable = __webpack_chunk_load__(chunkId);
7376
promises.push(thenable);
7477
const resolve = chunkCache.set.bind(chunkCache, chunkId, null);
75-
thenable.then(resolve);
78+
thenable.then(resolve, ignoreReject);
7679
chunkCache.set(chunkId, thenable);
7780
} else if (entry !== null) {
7881
promises.push(entry);

0 commit comments

Comments
 (0)