We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a2cbf25 commit 7db9f23Copy full SHA for 7db9f23
1 file changed
lib/graphql/dataloader/null_dataloader.rb
@@ -37,13 +37,17 @@ def run(trace_query_lazy: nil)
37
end
38
39
def run_isolated
40
- new_dl = self.class.new
+ # Reuse this instance because execution code may already have a reference to _this_ `dataloader` inside the given block.
41
+ prev_lazies_at_depth = @lazies_at_depth
42
+ @lazies_at_depth = @lazies_at_depth.dup.clear
43
res = nil
- new_dl.append_job {
44
+ append_job {
45
res = yield
46
}
- new_dl.run
47
+ run
48
res
49
+ ensure
50
+ @lazies_at_depth = prev_lazies_at_depth
51
52
53
def clear_cache; end
0 commit comments