Files
react/packages/react-server-native-relay/src/ReactFlightNativeRelayServer.js
T
Sebastian Markbåge 7843b142ac [Fizz/Flight] Pass in Destination lazily to startFlowing instead of in createRequest (#22449)
* Pass in Destination lazily in startFlowing instead of createRequest

* Delay fatal errors until we have a destination to forward them to

* Flow can now be inferred by whether there's a destination set

We can drop the destination when we're not flowing since there's nothing to
write to.

Fatal errors now close once flowing starts back up again.

* Defer fatal errors in Flight too
2021-09-28 15:32:09 -07:00

33 lines
698 B
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {ReactModel} from 'react-server/src/ReactFlightServer';
import type {
BundlerConfig,
Destination,
} from './ReactFlightNativeRelayServerHostConfig';
import {
createRequest,
startWork,
startFlowing,
} from 'react-server/src/ReactFlightServer';
function render(
model: ReactModel,
destination: Destination,
config: BundlerConfig,
): void {
const request = createRequest(model, config);
startWork(request);
startFlowing(request, destination);
}
export {render};