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

polish: skip recollecting a named fragment's selections even when deferred #4320

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Jan 9, 2025

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 https://github.com//pull/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.]

now that we do not have duplication
@yaacovCR yaacovCR marked this pull request as ready for review January 9, 2025 16:26
@yaacovCR yaacovCR requested a review from a team as a code owner January 9, 2025 16:26
@yaacovCR yaacovCR requested a review from robrichard January 9, 2025 16:27
Copy link

netlify bot commented Jan 9, 2025

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit ae933ea
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/677ff8d00c25800008c12e26
😎 Deploy Preview https://deploy-preview-4320--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.

Copy link

github-actions bot commented Jan 9, 2025

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 yaacovCR changed the title deferred named fragments can be skipped if non-deferred overlapping named fragments can be skipped even when deferred Jan 9, 2025
@yaacovCR yaacovCR changed the title overlapping named fragments can be skipped even when deferred polish: overlapping named fragments can be skipped even when deferred Jan 9, 2025
@yaacovCR yaacovCR changed the title polish: overlapping named fragments can be skipped even when deferred polish: skip recollecting a named fragment's selections even when deferred Jan 9, 2025
@yaacovCR
Copy link
Contributor Author

yaacovCR commented Jan 9, 2025

Edited description a bit above based on offline conversation with @JoviDeCroock , hope it's more understandable. Basically, we no longer need this check with the non-duplicating version of incremental delivery, and we may have never needed it, plus there was a bit that was broken with it.

@yaacovCR yaacovCR merged commit 9e39e59 into graphql:main Jan 9, 2025
22 checks passed
@yaacovCR yaacovCR deleted the remove-check branch January 9, 2025 19:41
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.

3 participants