LWC - Data Access

GraphQL Wire Adapter for LWC

A practical guide to using lightning/graphql in Lightning Web Components, including where it shines, where it does not, and how it compares with other LDS access patterns.

9 min readPublished April 13, 2026By Shivam Gupta
Shivam Gupta
Shivam GuptaSalesforce Architect and founder at pulsagi.com
Web component and data layer design

This article is based on the GraphQL wire adapter docs and keeps the focus on practical LWC architecture choices.

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.

Current default: Salesforce recommends 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/graphql does not support Mobile Offline.
  • Variables in directives such as @skip and @include are 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.

References