Skip to content

Visibility: require all root config before preloading#5635

Merged
rmosolgo merged 3 commits into
masterfrom
visibility-preload-config-fix
May 21, 2026
Merged

Visibility: require all root config before preloading#5635
rmosolgo merged 3 commits into
masterfrom
visibility-preload-config-fix

Conversation

@rmosolgo
Copy link
Copy Markdown
Owner

@rmosolgo rmosolgo commented May 15, 2026

Important

If you're using Rails and have use GraphQL::Schema::Visibility before configuring your root types,
this will raise an error at application boot.

Fix the error by moving use ... below that configuration.

Your app will boot faster every time after that!

Fixes #5454

GraphQL::Schema::Visibility didn't handle it right when root-level configurations came after use ... preload: true. It tried to, but profiles still weren't actually preloaded correctly.

When configuration is inherited, it has to fall back to rebuilding the visibility cache dynamically. This is slower than the new behavior ... but it's also how it used to always work. It can be avoided by removing use ... from the parent class and putting it in child classes only.

@rmosolgo rmosolgo added this to the 2.6.3 milestone May 21, 2026
wrapped_object = @object_class.wrap(obj, query_ctx)
@inner_resolve.call(wrapped_object, args, ctx)
end
end
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I think this was very old!

@rmosolgo rmosolgo merged commit 4602e4a into master May 21, 2026
33 of 37 checks passed
@rmosolgo rmosolgo deleted the visibility-preload-config-fix branch May 21, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GraphQL::Schema::Visibility preload crashes if query type is not set first

1 participant