Skip to content

Remember initial types instead of lazy-loading#1697

Open
rudiedirkx wants to merge 2 commits intowebonyx:masterfrom
rudiedirkx:initial-types
Open

Remember initial types instead of lazy-loading#1697
rudiedirkx wants to merge 2 commits intowebonyx:masterfrom
rudiedirkx:initial-types

Conversation

@rudiedirkx
Copy link
Copy Markdown

Types that are given in schema config 'types' don't have to be 'typeLoader' loaded later:

new Schema([
	'typeLoader' => function(string $name) {
		return GraphQLFactory::type(sprintf('App\Services\GraphQL\Schema\%sType', $name));
	},
	'query' => GraphQLFactory::type(ClubQueryType::class),
	'mutation' => GraphQLFactory::type(ClubMutationType::class),
	'types' => [
		GraphQLFactory::type(ReservationInterfaceType::class),
		GraphQLFactory::type(ClassReservationType::class),
		GraphQLFactory::type(CourtReservationType::class),
	],
]);

The 3 provided types don't have to go through the typeLoader. In my case the type loader doesn't work for those 3, but everything else should be lazy loader by typeLoader.

This might break something else, but I'm curious to see all the tests.

Loading
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.

3 participants