Skip to content

Commit 11ed7c3

Browse files
committed
Share async dispatchers
1 parent 72abf19 commit 11ed7c3

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

packages/react-server/src/ReactFlightServer.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -441,15 +441,11 @@ function RequestInstance(
441441
onAllReady: void | (() => void),
442442
onFatalError: void | ((error: mixed) => void),
443443
) {
444-
if (
445-
ReactSharedInternals.A !== null &&
446-
ReactSharedInternals.A !== DefaultAsyncDispatcher
447-
) {
448-
throw new Error(
449-
'Currently React only supports one RSC renderer at a time.',
450-
);
444+
const previousAsyncDispatcher = ReactSharedInternals.A;
445+
if (previousAsyncDispatcher === null) {
446+
ReactSharedInternals.A = DefaultAsyncDispatcher;
451447
}
452-
ReactSharedInternals.A = DefaultAsyncDispatcher;
448+
453449
if (__DEV__) {
454450
// Unlike Fizz or Fiber, we don't reset this and just keep it on permanently.
455451
// This lets it act more like the AsyncDispatcher so that we can get the

0 commit comments

Comments
 (0)