Skip to content

Commit dbb060d

Browse files
authored
Pass BundlerConfig through to Relay Integration (facebook#18393)
I wasn't sure we needed this but looks like it'll come in handy.
1 parent ce6fe50 commit dbb060d

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

packages/react-flight-dom-relay/src/ReactFlightDOMRelayServer.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88
*/
99

1010
import type {ReactModel} from 'react-server/src/ReactFlightServer';
11-
import type {Destination} from './ReactFlightDOMRelayServerHostConfig';
11+
import type {
12+
BundlerConfig,
13+
Destination,
14+
} from './ReactFlightDOMRelayServerHostConfig';
1215

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

15-
function render(model: ReactModel, destination: Destination): void {
16-
let request = createRequest(model, destination, undefined);
18+
function render(
19+
model: ReactModel,
20+
destination: Destination,
21+
config: BundlerConfig,
22+
): void {
23+
let request = createRequest(model, destination, config);
1724
startWork(request);
1825
}
1926

packages/react-flight-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {Request, ReactModel} from 'react-server/src/ReactFlightServer';
1111

1212
import type {
1313
Destination,
14+
BundlerConfig,
1415
ModuleReference,
1516
ModuleMetaData,
1617
} from 'ReactFlightDOMRelayServerIntegration';
@@ -25,17 +26,16 @@ import {
2526

2627
export type {
2728
Destination,
29+
BundlerConfig,
2830
ModuleReference,
2931
ModuleMetaData,
3032
} from 'ReactFlightDOMRelayServerIntegration';
3133

32-
export type BundlerConfig = void;
33-
3434
export function resolveModuleMetaData<T>(
3535
config: BundlerConfig,
3636
resource: ModuleReference<T>,
3737
): ModuleMetaData {
38-
return resolveModuleMetaDataImpl(resource);
38+
return resolveModuleMetaDataImpl(config, resource);
3939
}
4040

4141
type JSONValue =

packages/react-flight-dom-relay/src/__mocks__/ReactFlightDOMRelayServerIntegration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ReactFlightDOMRelayServerIntegration = {
2323
});
2424
},
2525
close(destination) {},
26-
resolveModuleMetaData(resource) {
26+
resolveModuleMetaData(config, resource) {
2727
return resource;
2828
},
2929
};

scripts/flow/react-relay-hooks.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type JSONValue =
1717

1818
declare module 'ReactFlightDOMRelayServerIntegration' {
1919
declare export opaque type Destination;
20+
declare export opaque type BundlerConfig;
2021
declare export function emitModel(
2122
destination: Destination,
2223
id: number,
@@ -33,6 +34,7 @@ declare module 'ReactFlightDOMRelayServerIntegration' {
3334
declare export opaque type ModuleReference<T>;
3435
declare export type ModuleMetaData = JSONValue;
3536
declare export function resolveModuleMetaData<T>(
37+
config: BundlerConfig,
3638
resourceReference: ModuleReference<T>,
3739
): ModuleMetaData;
3840
}

0 commit comments

Comments
 (0)