Skip to content

Commit af10dfd

Browse files
committed
Share async dispatchers
1 parent 72abf19 commit af10dfd

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/react-server/src/ReactFlightServer.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
enableTaint,
2121
enableRefAsProp,
2222
enableServerComponentLogs,
23+
disableStringRefs,
2324
enableOwnerStacks,
2425
} from 'shared/ReactFeatureFlags';
2526

@@ -441,15 +442,11 @@ function RequestInstance(
441442
onAllReady: void | (() => void),
442443
onFatalError: void | ((error: mixed) => void),
443444
) {
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-
);
445+
const previousAsyncDispatcher = ReactSharedInternals.A;
446+
if (previousAsyncDispatcher === null) {
447+
ReactSharedInternals.A = DefaultAsyncDispatcher;
451448
}
452-
ReactSharedInternals.A = DefaultAsyncDispatcher;
449+
453450
if (__DEV__) {
454451
// Unlike Fizz or Fiber, we don't reset this and just keep it on permanently.
455452
// This lets it act more like the AsyncDispatcher so that we can get the

0 commit comments

Comments
 (0)