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

simplify CollectFields for @defer and @stream #3994

Merged
merged 4 commits into from
Dec 16, 2023
Merged

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Dec 8, 2023

minimizes changes to CollectFields a la #3982 but still creates a single memoized incremental field plan per list item.

@robrichard

Copy link

netlify bot commented Dec 8, 2023

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit 24784b3
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/657bf99e6d0a98000823aee9
😎 Deploy Preview https://deploy-preview-3994--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@yaacovCR yaacovCR added the PR: polish 💅 PR doesn't change public API or any observed behaviour label Dec 8, 2023
@yaacovCR yaacovCR requested a review from robrichard December 8, 2023 12:44
Copy link

github-actions bot commented Dec 8, 2023

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@yaacovCR
Copy link
Contributor Author

yaacovCR commented Dec 8, 2023

this PR also removes code that supports graphql/graphql-spec#1054 => as noted there, that "feature" is not necessarily desirable, and after feedback from the sub-WG, it seems like we should merge support for that later on in a separate PR.

@yaacovCR yaacovCR changed the title alternative to simplify CollectFIelds for @defer @stream alternative to simplify CollectFields for @defer @stream Dec 8, 2023
minimizes changes to CollectFields a la graphql#3982 but still creates a single memoized incremental field plan per list item.
@yaacovCR
Copy link
Contributor Author

Updated graphql/graphql-spec#1052 to reflect simplification from this PR.

in favor of resolution at runtime

this is a tradeoff of theoretical performance gain vs code simplification
@yaacovCR yaacovCR changed the title alternative to simplify CollectFields for @defer @stream simplify CollectFields for @defer and @stream Dec 16, 2023
@yaacovCR yaacovCR merged commit 2aedf25 into graphql:main Dec 16, 2023
18 checks passed
@yaacovCR yaacovCR deleted the simplify branch December 16, 2023 19:15
yaacovCR added a commit to yaacovCR/graphql-js that referenced this pull request Dec 16, 2023
minimizes the changes to `CollectFields` required for incremental delivery (inspired by graphql#3982) -- but retains a single memoized incremental field plan per list item.
yaacovCR added a commit that referenced this pull request Jan 9, 2025
…erred (#4320)

In the "old" duplicating version of incremental delivery,
`collectFields()` was responsible for branching, and it therefore
allowed processing a deferred named fragment even if that named fragment
had already been visited as a regular non-deferred named fragment.

One could have argued against that, as the old version had the concept
of inlining, and so we could have just skipped the named fragment and
considered it inlined, but chose not to do that.

Now that we have an algorithm without duplication of fields, revisiting
a named fragment will have no effect, as within the
`buildExecutionPlan()` step, all the duplicated fields will be removed.
So we can just remove the exception and go back to the version
pre-incremental delivery where we always skip a visited named fragment.

Note that we still only consider a named fragment to have been visited
if it was not marked as deferred, because in the case of overlapping
deferred and non-deferred spreads of the same named fragment, we need to
visit it as the non-deferred spread to actually realize that it is
non-deferred.

[As an aside, looks like I made a mistake in
#3994 => we would never have
wanted to ignore the result of `shouldIncludeNode()` => since we are
removing all ignoring of these conditions with respect to defer, this PR
"fixes" that mistake as well.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: polish 💅 PR doesn't change public API or any observed behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants