Skip to content

Commit b447234

Browse files
committed
[Flight] Failing test for dropped transport of undefined object values
1 parent 9c54b29 commit b447234

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/react-client/src/__tests__/ReactFlight-test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,25 @@ describe('ReactFlight', () => {
213213
expect(ReactNoop).toMatchRenderedOutput(null);
214214
});
215215

216+
it('can transport undefined object values', async () => {
217+
function ComponentClient(props) {
218+
return 'prop' in props
219+
? `\`prop\` in props as '${props.prop}'`
220+
: '`prop` not in props';
221+
}
222+
const Component = clientReference(ComponentClient);
223+
224+
const model = <Component prop={undefined} />;
225+
226+
const transport = ReactNoopFlightServer.render(model);
227+
228+
await act(async () => {
229+
ReactNoop.render(await ReactNoopFlightClient.read(transport));
230+
});
231+
232+
expect(ReactNoop).toMatchRenderedOutput("`prop` in props as 'undefined'");
233+
});
234+
216235
it('can render an empty fragment', async () => {
217236
function Empty() {
218237
return <React.Fragment />;

0 commit comments

Comments
 (0)