-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix hasNextPage when max_page_size is set #4780
Conversation
This change broke a lot of our clients since we were dependent on the old (incorrect) behavior. Clients were not explicitly passing module Types
class BaseArgument < GraphQL::Schema::Argument
def initialize(name, type, desc = nil, **kwargs)
if name == :first && kwargs[:owner].connection?
kwargs[:default_value] = kwargs[:owner].default_page_size || MyAppSchema.default_page_size
end
super
end
end
end This will explicitly set the default value of the |
Thanks for sharing that solution, @porter77 🍻 |
@rmosolgo we also just had a small incident because of this surprise. Frankly, the relay spec doesn't seem to support a default max-page-size at all... if no In this part of the spec, I would consider a default max-page-size value to count as "first being set" in the absence of all other values... |
I (think I) understand the index bug from #4765, but I don't understand the hasNextPage part of the discussion, why is |
Yeah, sorry about the trouble ... maybe this was the wrong approach. I'm open to making it return |
Here's a PR to revert the change to |
Sorry for the disruption caused by this change -- I'm going to revert it in 2.2.12, so that |
I just shipped the revert (#4866) in 2.2.12. Sorry again for the trouble from this! |
About hasNextPage, the relay spec says:
But GraphQL-Ruby's
max_page_size
was causing it to take the "if first is set..." branch even when the client didn't providefirst
.After this change, it will fall down to the "Return false" branch of that spec unless
first
is explicitly provided by the client.Fixes #4765