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

don't re-scope nodes or edges #4263

Merged
merged 1 commit into from
Dec 7, 2022
Merged

don't re-scope nodes or edges #4263

merged 1 commit into from
Dec 7, 2022

Conversation

rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Dec 6, 2022

Fixes #4253

To get the old behavior, you could update your base connection class to mix scope: true into the field options, for example:

  class Types::BaseConnection < Types::BaseObject 
    include GraphQL::Types::Relay::ConnectionBehaviors 

    def self.edge_type(*args, field_options: {}, **kwargs)
      field_options[:scope] = true # Add this to all nodes fields 
      super(field_options: field_options, **kwargs)
    end 

    def self.nodes_field(field_options: {}, **kwargs)
      field_options[:scope] = true # Add this to all nodes fields 
      super(field_options: field_options, **kwargs)
    end 
  end 

But I can't think why someone would want this, since the connection field itself applies scoping to begin with.

@rmosolgo rmosolgo added this to the 2.0.16 milestone Dec 6, 2022
@rmosolgo rmosolgo merged commit 32e94c1 into master Dec 7, 2022
@rmosolgo rmosolgo deleted the fix-double-scoping branch December 7, 2022 15:22
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.

Double call of scope_items method before and after pagination
1 participant