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

Consider variable default values with @skip/@include/@defer #4785

Merged
merged 7 commits into from
Mar 24, 2023

Conversation

BoD
Copy link
Contributor

@BoD BoD commented Mar 22, 2023

Related to #4784

In the response adapters, we generate lines like this:

if (not(variable("skipIf")).evaluate(customScalarAdapters.adapterContext.variables(), __typename, customScalarAdapters.adapterContext, null)) {
  // Read fields for the fragment
}

but customScalarAdapters.adapterContext.variables() was empty, since it only considered variables that are not optional, or optional and present.

with this approach we include the optionals that are absent and have a default value (booleans only)

@netlify
Copy link

netlify bot commented Mar 22, 2023

Deploy Preview for apollo-android-docs canceled.

Name Link
🔨 Latest commit e65c709
🔍 Latest deploy log https://app.netlify.com/sites/apollo-android-docs/deploys/641c5be685330b0008f9f9b7

@BoD
Copy link
Contributor Author

BoD commented Mar 23, 2023

Just pushed:

@BoD BoD marked this pull request as ready for review March 23, 2023 14:05
@BoD BoD requested a review from martinbonnin as a code owner March 23, 2023 14:05
Copy link
Contributor

@martinbonnin martinbonnin left a comment

Choose a reason for hiding this comment

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

👏

@BoD
Copy link
Contributor Author

BoD commented Mar 24, 2023

⚠️ Just a reminder that tweaks will be needed to avoid breaking changes when backporting to 3.x

@BoD BoD added this pull request to the merge queue Mar 24, 2023
Merged via the queue into main with commit 964c641 Mar 24, 2023
@BoD BoD deleted the skip-variable-default-false branch March 24, 2023 07:54
@martinbonnin martinbonnin mentioned this pull request Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants