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/graphql
provides newer features, such as optional fields and dynamic query construction.lightning/graphql
enables you to trigger a refresh of the query results by calling therefresh
method on the emitted data.lightning/uiGraphQLApi
supports Mobile Offline use cases, butlightning/graphql
doesn’t.lightning/uiGraphQLApi
enables 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