GraphQL API Wire Adapter
Fetch data using the GraphQL API wire adapter for LWC, which comes with client-side caching and data management capabilities.
lightning/graphql (v2) supersedes the lightning/uiGraphQLApi (v1) module. Here are several differences between the modules:
lightning/graphqlprovides newer features, such as optional fields and dynamic query construction.lightning/graphqlenables you to trigger a refresh of the query results by calling therefreshmethod on the emitted data.lightning/uiGraphQLApisupports Mobile Offline use cases, butlightning/graphqldoesn’t.lightning/uiGraphQLApienables you to trigger a refresh of the query results by calling therefreshGraphQL(result)function.
The terms v2 and v1 are annotations that are used only in documentation to highlight the difference and recency of the modules.
This table compares the GraphQL API wire adapters and the features they support.
| GraphQL API Wire Adapter Feature | lightning/uiGraphQLApi (v1) | lightning/graphql (v2) |
|---|---|---|
| Mobile Offline | ![]() | |
| Standard GraphQL API features | ![]() | ![]() |
| Optional fields | ![]() | |
| Dynamic query construction | ![]() |
For usage details, see these references.
See Also
