Skip to content

Comments

Release 4.2#13129

Draft
jerelmiller wants to merge 4 commits intomainfrom
release-4.2
Draft

Release 4.2#13129
jerelmiller wants to merge 4 commits intomainfrom
release-4.2

Conversation

@jerelmiller
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: 001df18

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: 001df18

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

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to release-4.2, this
PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`release-4.2` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `release-4.2`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @apollo/client@4.2.0-alpha.0

### Minor Changes

- [#13130](#13130)
[`dd12231`](dd12231)
Thanks [@jerelmiller](https://github.com/jerelmiller)! - Improve the
accuracy of `client.query` return type to better detect the current
`errorPolicy`. The `data` property is no longer nullable when the
`errorPolicy` is `none`. This makes it possible to remove the
`undefined` checks or optional chaining in most cases.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@DRoet
Copy link

DRoet commented Feb 21, 2026

Would it be possible to release another alpha which includes the 4.1.5 changes?

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.

3 participants