File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,8 @@ def run_isolated
163
163
prev_pending_keys = { }
164
164
prev_lazies_at_depth = @lazies_at_depth
165
165
@lazies_at_depth = @lazies_at_depth . dup . clear
166
+ # Clear pending loads but keep already-cached records
167
+ # in case they are useful to the given block.
166
168
@source_cache . each do |source_class , batched_sources |
167
169
batched_sources . each do |batch_args , batched_source_instance |
168
170
if batched_source_instance . pending?
Original file line number Diff line number Diff line change @@ -37,14 +37,17 @@ def run(trace_query_lazy: nil)
37
37
end
38
38
39
39
def run_isolated
40
- prev_lazies_at_depth = @lazies_at_depth
41
- @lazies_at_depth = @lazies_at_depth . dup . clear
42
- yield
43
- ensure
44
- @lazies_at_depth = prev_lazies_at_depth
40
+ new_dl = self . class . new
41
+ res = nil
42
+ new_dl . append_job {
43
+ res = yield
44
+ }
45
+ new_dl . run
46
+ res
45
47
end
46
48
47
49
def clear_cache ; end
50
+
48
51
def yield ( _source )
49
52
raise GraphQL ::Error , "GraphQL::Dataloader is not running -- add `use GraphQL::Dataloader` to your schema to use Dataloader sources."
50
53
end
You can’t perform that action at this time.
0 commit comments