graphql-laravel
graphql-laravel copied to clipboard
Implement lazy root types
Summary
This PR implements the lazy root types, supported since 15.6.0 of webonyx/graphql-php. I see some performance improvements by this change, tested in a project with several queries and mutations.
Type of change:
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
- [x] Misc. change (internal, infrastructure, maintenance, etc.)
Checklist:
- [ ] Existing tests have been adapted and/or new tests have been added
- [x] Add a CHANGELOG.md entry
- [ ] Update the README.md
- [x] Code style has been fixed via
composer fix-style
Wow!
I guess this will fix https://github.com/rebing/graphql-laravel/discussions/1087 !
When executing a gql query, the mutations are no longer initialized with this change, but other query classes still are. So #1087 isn't fully solved, but I think there is more possible.
but other query classes still are
Why this? I wouldn't have figured from the code.
To resolve a query, all the fields of the Query root type are loaded in GraphQL::buildObjectTypeFromFields. It's possible to make them lazy as well, but only if the names are already set in de config, see #1092.