Open AllanOricil opened 1 year ago
This loader would be useful for LWR projects as well
The local dev server must also support this
Look how horrible this looks 😅
Thanks for providing feedback @AllanOricil, this is part of Lightning Data Services.
I've tagged a few members of the team to take a look.
@scarrawaySF @jodarove
Is your feature request related to a problem? Please describe.
Writing graphql queries in components is too verbose. It could also lead to code duplication if multiple components need the same query with different sets of variables.
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_graphql
Describe the solution you'd like
.graphql files could be bundled with lightning components during deployments.
With .graphql files developers can:
It must also let developers to import
.graphql
from other bundlesWebpack graphql loader
https://www.npmjs.com/package/@graphql-tools/webpack-loader
https://www.npmjs.com/package/webpack-graphql-loader
https://medium.com/modus-create-front-end-development/load-your-graphql-documents-with-webpack-apollo-c1e166404cba
After releasing this loader I would also deprecate this inline graphql feature to encourage people to use .graphql files
Describe alternatives you've considered I could write my own loader
Or
As an alternative for modularization people can do the following
then import
myQuery
in their components and pass its ref to wire. It is just really annoying having to import thegql
module multiple times, specially when organizing queries in multiple modules, or the need to wrap the query in an object by hand.Additional context N/A