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 +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/config/initializers/patch_continue_value.rb +13 -15
- data/lib/graphql_preload_queries/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6c097ebc42e856cee8e7bf0d47d97094977294c59b38a4919c83c2cb9dfcd8e
|
4
|
+
data.tar.gz: 969218ee1d4eb0a6683852ad73b2471ca47966ed4dc785cb554e40f3f2195acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee2df1f6f245eca40436df7bf93146bd27488ae6c884218b942a15e67b1c40d086e88cc864b834e9dc855b61282373d1e665da18f2c80ee03a146ed90ba4d08d
|
7
|
+
data.tar.gz: 9c5fcf16de9709a93cb3b2208a1702de7265322dcd57f971232167e61385f4caefa4c6b61127fc0c899db2add1c09b8255d13394f935cc8c8e111b34a79ce062
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
17
|
-
|
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
|