You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Schema.resolves_lazies? currently assumes that the first two entries in lazy_methods don't require lazy handling:
lazy_method_count > 2
Those entries are the default handlers for GraphQL::Execution::Lazy and GraphQL::Dataloader::Request. As a result, Execution::Next skips lazy detection on schemas without an additional lazy_resolve registration.
For example, returning a GraphQL::Dataloader::Request produces its object representation instead of the loaded value:
The count is also unstable because LazyMethodMap caches subclass lookups in the same storage. Resolving a subclass of a registered lazy type adds another entry and can change resolves_lazies? from false to true based on execution history.
This PR treats any non-nil lazy method registration, including the default registrations, as enabling lazy resolution. Cached subclass lookups can no longer change the result because a non-nil subclass cache entry requires an existing non-nil superclass registration.
I found this while testing a resolver that returned .request(...), but I don't have a case where returning the request is preferable to calling .load. I also confirmed that this path is already deprecated through load_with_deprecation_warning.
Without supporting returned Request instances, the user-visible fix in this PR isn't needed. The cache-dependent resolves_lazies? behavior is real, but custom lazy_resolve registrations already enable lazy handling before cached subclass entries matter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Schema.resolves_lazies?currently assumes that the first two entries inlazy_methodsdon't require lazy handling:Those entries are the default handlers for GraphQL::Execution::Lazy and GraphQL::Dataloader::Request. As a result, Execution::Next skips lazy detection on schemas without an additional lazy_resolve registration.
For example, returning a GraphQL::Dataloader::Request produces its object representation instead of the loaded value:
The count is also unstable because LazyMethodMap caches subclass lookups in the same storage. Resolving a subclass of a registered lazy type adds another entry and can change resolves_lazies? from false to true based on execution history.
This PR treats any non-nil lazy method registration, including the default registrations, as enabling lazy resolution. Cached subclass lookups can no longer change the result because a non-nil subclass cache entry requires an existing non-nil superclass registration.