Skip to content

Commit

Permalink
Make startFlowing explicit in Flight
Browse files Browse the repository at this point in the history
This is already an explicit call in Fizz. This moves flowing to be explicit.

That way we can avoid calling it in start() for web streams and therefore
avoid the reentrant call.
  • Loading branch information
sebmarkbage committed Sep 27, 2021
1 parent 3aacb60 commit 8f0fd1a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/react-noop-renderer/src/ReactNoopFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function render(model: ReactModel, options?: Options): Destination {
options ? options.onError : undefined,
);
ReactNoopFlightServer.startWork(request);
ReactNoopFlightServer.startFlowing(request);
return destination;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import type {
Destination,
} from './ReactFlightDOMRelayServerHostConfig';

import {createRequest, startWork} from 'react-server/src/ReactFlightServer';
import {
createRequest,
startWork,
startFlowing,
} from 'react-server/src/ReactFlightServer';

type Options = {
onError?: (error: mixed) => void,
Expand All @@ -32,6 +36,7 @@ function render(
options ? options.onError : undefined,
);
startWork(request);
startFlowing(request);
}

export {render};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import type {
Destination,
} from './ReactFlightNativeRelayServerHostConfig';

import {createRequest, startWork} from 'react-server/src/ReactFlightServer';
import {
createRequest,
startWork,
startFlowing,
} from 'react-server/src/ReactFlightServer';

function render(
model: ReactModel,
Expand All @@ -22,6 +26,7 @@ function render(
): void {
const request = createRequest(model, destination, config);
startWork(request);
startFlowing(request);
}

export {render};
1 change: 0 additions & 1 deletion packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,6 @@ function flushCompletedChunks(request: Request): void {
}

export function startWork(request: Request): void {
request.flowing = true;
scheduleWork(() => performWork(request));
}

Expand Down

0 comments on commit 8f0fd1a

Please sign in to comment.