Skip to content

Commit

Permalink
Switch the isPrimaryRender flag based on the stream config (#21357)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage authored Apr 27, 2021
1 parent bd4f056 commit 4a8deb0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react-dom/src/server/ReactDOMServerFormatConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
writeChunk,
stringToChunk,
stringToPrecomputedChunk,
isPrimaryStreamConfig,
} from 'react-server/src/ReactServerStreamConfig';

import {
Expand Down Expand Up @@ -50,7 +51,7 @@ import isArray from 'shared/isArray';

// Used to distinguish these contexts from ones used in other renderers.
// E.g. this can be used to distinguish legacy renderers from this modern one.
export const isPrimaryRenderer = true;
export const isPrimaryRenderer = isPrimaryStreamConfig;

// Per response, global state that is not contextual to the rendering subtree.
export type ResponseState = {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-server/src/ReactServerStreamConfigBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export type Destination = ReadableStreamController;
export type PrecomputedChunk = Uint8Array;
export type Chunk = Uint8Array;

export const isPrimaryStreamConfig = true;

export function scheduleWork(callback: () => void) {
callback();
}
Expand Down
2 changes: 2 additions & 0 deletions packages/react-server/src/ReactServerStreamConfigNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export type Destination = Writable & MightBeFlushable;
export type PrecomputedChunk = Uint8Array;
export type Chunk = string;

export const isPrimaryStreamConfig = true;

export function scheduleWork(callback: () => void) {
setImmediate(callback);
}
Expand Down

0 comments on commit 4a8deb0

Please sign in to comment.