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, dynamic query construction, and mutations.
  • lightning/graphql enables you to trigger a refresh of the query results by calling the refresh method on the emitted data.
  • lightning/uiGraphQLApi supports Mobile Offline use cases, but lightning/graphql doesn’t.
  • lightning/uiGraphQLApi enables you to trigger a refresh of the query results by calling the refreshGraphQL(result) function.

The terms v2 and v1 are annotations that are used only in documentation to highlight the difference and recency of the modules.

Note

GraphQL API Wire Adapter Comparison 

This table compares the GraphQL API wire adapters and the features they support.

GraphQL API Wire Adapter Featurelightning/uiGraphQLApi (v1)lightning/graphql (v2)
Mobile OfflineYes
Standard GraphQL API featuresYesYes
Optional fieldsYes
Dynamic query constructionYes
Mutation operationsYes

For usage details, see these references.

See Also

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.