facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.27k stars 1.8k forks source link

Add more data to RelayResponseNormalizer warnings #4655

Closed yamadapc closed 3 months ago

yamadapc commented 3 months ago

When developing examples, tests or integration tests that use Relay and mock data. Sometimes RelayResponseNormalizer might print warnings regarding missing fields due to mocks that need to be updated.

The current warning is harder to action because there is no information about what part of the GraphQL response is missing the field.

For example, if the id field is missing on any part of the GraphQL response, the warning is:

Warning: RelayResponseNormalizer: Payload did not contain a value for field `id: id`. Check that you are parsing with the same query that was used to fetch the payload.

Which could be anywhere in the response.

This commit adds the data and record ID being updated to the warning so that it's easier to debug.

facebook-github-bot commented 3 months ago

Hi @yamadapc!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!