Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to current object for readField only when from omitted. #8508

Merged
merged 2 commits into from
Jul 21, 2021

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Jul 16, 2021

Should help with #8499, by making readField not suddenly fall back to reading from the current object when the caller attempts to pass a value for the from option/argument but ends up passing undefined. The readField function also now prints a warning when this situation occurs.

@willrax Is this what you had in mind? Specifically, you want both the warning and the behavior change of not defaulting to objectOrReference when from is explicitly passed (but undefined)?

@brainkim
Copy link
Contributor

brainkim commented Jul 16, 2021

Don’t have the full context on this, but it looks like it works and fixes the errors in studio! LGTM Woops this is the wrong PR.

Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome - thanks @benjamn!

@benjamn benjamn merged commit 92520dd into release-3.4 Jul 21, 2021
@benjamn benjamn deleted the issue-8499-readField-improvements branch July 21, 2021 17:31
benjamn added a commit that referenced this pull request Jul 23, 2021
Fixing a regression introduced by #8508.

Importing from @apollo/client/testing in cache/inmemory/policies.ts made
Rollup display circular dependency warnings (which are often harmless
but also worth avoiding) and resulted in importing React-related code
even when using @apollo/client/core rather than @apollo/client, which is
a more serious problem.
@hwillson hwillson removed this from the MM-2021-07 milestone Jul 29, 2021
@willrax
Copy link

willrax commented Sep 8, 2021

Thanks so much @benjamn, just saw this error come through in one of our tests.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

warning on undefined from field in readField
4 participants