Skip to content

Commit

Permalink
Switch the isPrimaryRender flag based on the stream config (facebook#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage authored and koto committed Jun 15, 2021
1 parent 6e3735a commit bc7d1ad
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 bc7d1ad

Please sign in to comment.