mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Pass BundlerConfig through to Relay Integration (#18393)
I wasn't sure we needed this but looks like it'll come in handy.
This commit is contained in:
committed by
GitHub
parent
ce6fe50b01
commit
dbb060d561
@@ -8,12 +8,19 @@
|
||||
*/
|
||||
|
||||
import type {ReactModel} from 'react-server/src/ReactFlightServer';
|
||||
import type {Destination} from './ReactFlightDOMRelayServerHostConfig';
|
||||
import type {
|
||||
BundlerConfig,
|
||||
Destination,
|
||||
} from './ReactFlightDOMRelayServerHostConfig';
|
||||
|
||||
import {createRequest, startWork} from 'react-server/src/ReactFlightServer';
|
||||
|
||||
function render(model: ReactModel, destination: Destination): void {
|
||||
let request = createRequest(model, destination, undefined);
|
||||
function render(
|
||||
model: ReactModel,
|
||||
destination: Destination,
|
||||
config: BundlerConfig,
|
||||
): void {
|
||||
let request = createRequest(model, destination, config);
|
||||
startWork(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import type {Request, ReactModel} from 'react-server/src/ReactFlightServer';
|
||||
|
||||
import type {
|
||||
Destination,
|
||||
BundlerConfig,
|
||||
ModuleReference,
|
||||
ModuleMetaData,
|
||||
} from 'ReactFlightDOMRelayServerIntegration';
|
||||
@@ -25,17 +26,16 @@ import {
|
||||
|
||||
export type {
|
||||
Destination,
|
||||
BundlerConfig,
|
||||
ModuleReference,
|
||||
ModuleMetaData,
|
||||
} from 'ReactFlightDOMRelayServerIntegration';
|
||||
|
||||
export type BundlerConfig = void;
|
||||
|
||||
export function resolveModuleMetaData<T>(
|
||||
config: BundlerConfig,
|
||||
resource: ModuleReference<T>,
|
||||
): ModuleMetaData {
|
||||
return resolveModuleMetaDataImpl(resource);
|
||||
return resolveModuleMetaDataImpl(config, resource);
|
||||
}
|
||||
|
||||
type JSONValue =
|
||||
|
||||
@@ -23,7 +23,7 @@ const ReactFlightDOMRelayServerIntegration = {
|
||||
});
|
||||
},
|
||||
close(destination) {},
|
||||
resolveModuleMetaData(resource) {
|
||||
resolveModuleMetaData(config, resource) {
|
||||
return resource;
|
||||
},
|
||||
};
|
||||
|
||||
2
scripts/flow/react-relay-hooks.js
vendored
2
scripts/flow/react-relay-hooks.js
vendored
@@ -17,6 +17,7 @@ type JSONValue =
|
||||
|
||||
declare module 'ReactFlightDOMRelayServerIntegration' {
|
||||
declare export opaque type Destination;
|
||||
declare export opaque type BundlerConfig;
|
||||
declare export function emitModel(
|
||||
destination: Destination,
|
||||
id: number,
|
||||
@@ -33,6 +34,7 @@ declare module 'ReactFlightDOMRelayServerIntegration' {
|
||||
declare export opaque type ModuleReference<T>;
|
||||
declare export type ModuleMetaData = JSONValue;
|
||||
declare export function resolveModuleMetaData<T>(
|
||||
config: BundlerConfig,
|
||||
resourceReference: ModuleReference<T>,
|
||||
): ModuleMetaData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user