diff --git a/lib/graphiti/scope.rb b/lib/graphiti/scope.rb index a19255e7..1dac31d4 100644 --- a/lib/graphiti/scope.rb +++ b/lib/graphiti/scope.rb @@ -150,6 +150,11 @@ def future_with_fiber_locals(*args) result = yield(*args) + if execution_context_changed + thread_storage&.keys&.each { |key| Thread.current[key] = nil } + fiber_storage&.keys&.each { |key| Fiber[key] = nil } + end + result end end