Created
October 26, 2022 01:51
-
-
Save jeromedalbert/68e58ce62563b3950bf5d715ca45fced to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Monkey patch to support an `enabled` option | |
module GraphQL | |
module FragmentCache | |
class << self | |
attr_accessor :enabled | |
end | |
self.enabled = true | |
class FieldExtension | |
module MonkeyPatch | |
def resolve(object:, arguments:, **_options) | |
return yield(object, arguments) if !GraphQL::FragmentCache.enabled | |
super | |
end | |
end | |
prepend MonkeyPatch | |
end | |
end | |
end | |
GraphQL::FragmentCache.enabled = false if Rails.env.test? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment