graphql-laravel icon indicating copy to clipboard operation
graphql-laravel copied to clipboard

Implement lazy root types

Open sforward opened this issue 1 year ago • 4 comments

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

sforward avatar Sep 10 '23 14:09 sforward

Wow!

I guess this will fix https://github.com/rebing/graphql-laravel/discussions/1087 !

mfn avatar Sep 11 '23 11:09 mfn

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.

sforward avatar Sep 11 '23 21:09 sforward

but other query classes still are

Why this? I wouldn't have figured from the code.

mfn avatar Sep 12 '23 05:09 mfn

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.

sforward avatar Sep 12 '23 07:09 sforward