Class: ActiveShopifyGraphQL::Connections::ConnectionLoader
- Inherits:
-
Object
- Object
- ActiveShopifyGraphQL::Connections::ConnectionLoader
- Defined in:
- lib/active_shopify_graphql/connections/connection_loader.rb
Overview
Handles loading records for GraphQL connections. Refactored to use LoaderContext for cleaner parameter passing.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context, loader_instance:) ⇒ ConnectionLoader
constructor
A new instance of ConnectionLoader.
-
#load_records(query_name, variables, parent = nil, connection_config = nil) ⇒ Array<Object>
Load records for a connection query.
Constructor Details
#initialize(context, loader_instance:) ⇒ ConnectionLoader
Returns a new instance of ConnectionLoader.
10 11 12 13 |
# File 'lib/active_shopify_graphql/connections/connection_loader.rb', line 10 def initialize(context, loader_instance:) @context = context @loader_instance = loader_instance end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/active_shopify_graphql/connections/connection_loader.rb', line 8 def context @context end |
Instance Method Details
#load_records(query_name, variables, parent = nil, connection_config = nil) ⇒ Array<Object>
Load records for a connection query
21 22 23 24 25 26 27 28 29 |
# File 'lib/active_shopify_graphql/connections/connection_loader.rb', line 21 def load_records(query_name, variables, parent = nil, connection_config = nil) is_nested = connection_config&.dig(:nested) || parent.respond_to?(:id) if is_nested && parent load_nested_connection(query_name, variables, parent, connection_config) else load_root_connection(query_name, variables, connection_config) end end |