graphql_preload_queries 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f78c5c6117d7157d648c6a1cdc325978bd74e0c8c068ab990be2e51817828923
4
- data.tar.gz: 2228f1f4c97aa0a29aca63bac1303c425e4a12e1b128dcc9e2d858fbb5067da9
3
+ metadata.gz: c6c097ebc42e856cee8e7bf0d47d97094977294c59b38a4919c83c2cb9dfcd8e
4
+ data.tar.gz: 969218ee1d4eb0a6683852ad73b2471ca47966ed4dc785cb554e40f3f2195acc
5
5
  SHA512:
6
- metadata.gz: d75f1393282b95a5f31202aae32634b042ef8ecd9bcf6bf947e3755fbc410994547177df7f3f924cf34b4d01298ae16da39ee216665b23ccf3de3f7460ad3d80
7
- data.tar.gz: 772e252ce3c527b5326b0c504f50bc897076721f7f3bc76cd2debec645da9ea8269d81aa6d8d31491ef9d4b6cb4bd5682fe652c7de505227d7391969f867d491
6
+ metadata.gz: ee2df1f6f245eca40436df7bf93146bd27488ae6c884218b942a15e67b1c40d086e88cc864b834e9dc855b61282373d1e665da18f2c80ee03a146ed90ba4d08d
7
+ data.tar.gz: 9c5fcf16de9709a93cb3b2208a1702de7265322dcd57f971232167e61385f4caefa4c6b61127fc0c899db2add1c09b8255d13394f935cc8c8e111b34a79ce062
@@ -1,3 +1,6 @@
1
+ ## 0.2.2 (21-01-2021)
2
+ - Fix: Fix deep recursive stack error
3
+
1
4
  ## 0.2.1 (21-01-2021)
2
5
  - fix: add default preload to key
3
6
  - fix: fix invalid key when deep preloading
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_preload_queries (0.2.0)
4
+ graphql_preload_queries (0.2.2)
5
5
  graphql
6
6
  rails
7
7
 
@@ -1,20 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Rails.application.config.to_prepare do
4
- GraphQL::Execution::Interpreter::Runtime.class_eval do
5
- alias_method :continue_value_old, :continue_value
6
- # gql args: path, value, parent_type, field, is_non_null, ast_node
7
- def continue_value(*args)
8
- value = args[1]
9
- ast_node = args[5]
10
- field = args[3]
11
- type_klass = field.owner
12
- if !value.is_a?(ActiveRecord::Relation) || value.loaded? || !type_klass.respond_to?(:preloads)
13
- return continue_value_old(*args)
14
- end
3
+ require 'graphql/execution/interpreter/runtime'
4
+ module GraphqlPreloadQueries::PatchContinueValue # rubocop:disable Style/ClassAndModuleChildren:
5
+ # gql args: path, value, parent_type, field, is_non_null, ast_node
6
+ def continue_value(*args)
7
+ value = args[1]
8
+ ast_node = args[5]
9
+ field = args[3]
10
+ type_klass = field.owner
11
+ is_active_record = value.is_a?(ActiveRecord::Relation)
12
+ return super if !is_active_record || value.loaded? || !type_klass.respond_to?(:preloads)
15
13
 
16
- klass = GraphqlPreloadQueries::Extensions::Preload
17
- klass.preload_associations(value, ast_node, type_klass)
18
- end
14
+ klass = GraphqlPreloadQueries::Extensions::Preload
15
+ klass.preload_associations(value, ast_node, type_klass)
19
16
  end
20
17
  end
18
+ GraphQL::Execution::Interpreter::Runtime.prepend GraphqlPreloadQueries::PatchContinueValue
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlPreloadQueries
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_preload_queries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - owen2345