Introduction
The GraphQL wire adapter lets Lightning Web Components query Salesforce data using the GraphQL API while still relying on Lightning Data Service for caching and data management. Salesforce documents two modules here: lightning/graphql and the older lightning/uiGraphQLApi.
lightning/graphql when possible. Use lightning/uiGraphQLApi only when you must support Mobile Offline.Why use it
- One wire adapter instead of many different resource-specific adapters.
- Support for filtering, aggregation, and multi-object retrieval.
- Shared caching through Lightning Data Service.
- Useful for cursor-style pagination and relationship-heavy read scenarios.
When to use it
Salesforce documentation is clear here: GraphQL wire adapter is strongest when the component needs to query exact objects and fields, reduce round trips, and traverse relationships in one request. Some other LDS adapters are more efficient when they already do exactly what you need.
Example
A dashboard component that needs Account, related Opportunity summary data, and filtered collections in one request is a better fit for GraphQL wire adapter than stitching together many record adapters. On the other hand, a simple record form is still usually better served by the simpler LDS patterns built for that job.
Limitations
lightning/graphqldoes not support Mobile Offline.- Variables in directives such as
@skipand@includeare not supported. - Features in the GraphQL API can take several releases to appear in the wire adapter.
- For pagination with an upper-bound limit, the upper bound must stay constant for that collection.
