Skip to content

Commit

Permalink
Use config.before_eager_load
Browse files Browse the repository at this point in the history
We want to make sure the gem is fully loaded in a production context
before the application begins eagerly loading, otherwise we emit a
warning. So, let's use config.before_eager_load to make sure gem eager
loading happens before the app.
  • Loading branch information
gmcgibbon committed Dec 5, 2024
1 parent 904c4d4 commit b8a850c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/graphql/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module GraphQL
class Railtie < Rails::Railtie
config.graphql = ActiveSupport::OrderedOptions.new
config.graphql.parser_cache = false
config.eager_load_namespaces << GraphQL
config.before_eager_load do
GraphQL.eager_load!
end

initializer("graphql.cache") do |app|
if config.graphql.parser_cache
Expand Down

0 comments on commit b8a850c

Please sign in to comment.