Switch the isPrimaryRender flag based on the stream config (#21357)
Sebastian Markbåge committed
Apr 26, 2021 at 22:37 UTC
4a8deb08367d93d51912871b6d0e62852d0e981a
3 files changed
+6
-1
packages/react-dom/src/server/ReactDOMServerFormatConfig.js
+2
-1
@@ -23,6 +23,7 @@ import {
23
writeChunk,
24
stringToChunk,
25
stringToPrecomputedChunk,
26
+ isPrimaryStreamConfig,
27
} from 'react-server/src/ReactServerStreamConfig';
28
29
import {
@@ -50,7 +51,7 @@ import isArray from 'shared/isArray';
51
52
// Used to distinguish these contexts from ones used in other renderers.
53
// E.g. this can be used to distinguish legacy renderers from this modern one.
53
-export const isPrimaryRenderer = true;
54
+export const isPrimaryRenderer = isPrimaryStreamConfig;
55
56
// Per response, global state that is not contextual to the rendering subtree.
57
export type ResponseState = {
packages/react-server/src/ReactServerStreamConfigBrowser.js
+2
@@ -12,6 +12,8 @@ export type Destination = ReadableStreamController;
12
export type PrecomputedChunk = Uint8Array;
13
export type Chunk = Uint8Array;
14
15
+export const isPrimaryStreamConfig = true;
16
+
17
export function scheduleWork(callback: () => void) {
18
callback();
19
}
packages/react-server/src/ReactServerStreamConfigNode.js
+2
@@ -21,6 +21,8 @@ export type Destination = Writable & MightBeFlushable;
21
export type PrecomputedChunk = Uint8Array;
22
export type Chunk = string;
23
24
+export const isPrimaryStreamConfig = true;
25
+
26
export function scheduleWork(callback: () => void) {
27
setImmediate(callback);
28
}