Skip to content

Infinite recursion possible with defer? #29

Answered by robrichard
yaacovCR asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, the idea is to make sure all the deferred fragments get executed and non-deferred fragments don't get de-duped by deferred ones. I think the check needs to be modified so we also don't add deferred fragments to visitedFragments. I'm going to make this change now.

If you skip validation, it is possible for execute to recurse infinitely today without defer with a query like this:

{
    hero {
        ...PersonFragment
    }
}

fragment PersonFragment on Person {
    friends {
         ...PersonFragment
    }
}

I'm not sure how important it is to guard against the additional scenario that defer introduces. It probably could be avoided with more complex logic.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@yaacovCR
Comment options

Comment options

You must be logged in to vote
1 reply
@yaacovCR
Comment options

Answer selected by robrichard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants