Skip to content

Conversation

@jerelmiller
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: b5d1765

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 4, 2026

npm i https://pkg.pr.new/apollographql/apollo-client/@apollo/client@13129

commit: b5d1765

jerelmiller and others added 2 commits February 6, 2026 13:13
Fixes #13123

Improves the return type of `client.query` to be smarter about the
applied `errorPolicy`. The `data` and `error` properties now better
reflect the expected runtime value for a given `errorPolicy`.

This allow the removal of `undefined` checks or optional chaining for
most uses of `client.query`.

> [!NOTE]
> The `ApolloClient.QueryResult` type is used in several places
throughout the code base, most of which do not know the underlying
`errorPolicy` applied (e.g. `refetchQueries`, which might have a mix of
`ObservableQuery` instances with different error policies). As such, I
left a fallback case that leaves the type as-is. You need to be explicit
about an error policy in order to get the smarter types.

---------

Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
@apollo-librarian
Copy link

apollo-librarian bot commented Feb 6, 2026

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 586f0d646499419f38a32219
Build Logs: View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants