From 2ec85b803d787a1a6d866a46460d715ee658be2d Mon Sep 17 00:00:00 2001 From: Tom Gasson Date: Thu, 3 Feb 2022 10:20:08 -0800 Subject: [PATCH] Fix null comparison for skip_printing_nulls (#3784) Summary: In `skip_printing_nulls` (https://github.com/facebook/relay/pull/3626) we change some `null` values to be undefined by skipping them in the output. Generally, the js code uses loose equality, either as * `field.X != null` * `field.X ?? default` * `if (field.X) {` which allows us to do this safely. The comparison this commit fixes was a rare exception to that showing up when using `required`, mocking data and `skip_printing_nulls` is enabled. Pull Request resolved: https://github.com/facebook/relay/pull/3784 Reviewed By: captbaritone Differential Revision: D33965847 Pulled By: alunyov fbshipit-source-id: 98f414e4f90738fcb68c940d6ce7208734c49297 --- packages/relay-test-utils/RelayMockPayloadGenerator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/relay-test-utils/RelayMockPayloadGenerator.js b/packages/relay-test-utils/RelayMockPayloadGenerator.js index 86b2970fdedb3..aad528b47ef18 100644 --- a/packages/relay-test-utils/RelayMockPayloadGenerator.js +++ b/packages/relay-test-utils/RelayMockPayloadGenerator.js @@ -699,7 +699,7 @@ class RelayMockPayloadGenerator { // information came from mock resolver __typename value and it was // an intentional selection of the specific type const isAbstractType = - field.concreteType === null && typeName === typeFromSelection.type; + field.concreteType == null && typeName === typeFromSelection.type; const generateDataForField = possibleDefaultValue => { const fieldDefaultValue =