npm @apollo/client 4.0.0-alpha.15
v4.0.0-alpha.15

latest releases: 4.0.4, 4.0.3, 4.0.2...
3 months ago

Major Changes

  • #12639 1bdf489 Thanks @jerelmiller! - Move internal testing utilities in @apollo/client/testing to @apollo/client/testing/internal and remove deprecated testing utilities. Some of the testing utilities exported from the @apollo/client/testing endpoint were not considered stable. As a result of this change, testing utilities or types exported from @apollo/client/testing are now considered stable and will not undergo breaking changes.

    The following APIs were removed. To migrate, update usages of the following APIs as such:

    createMockClient

    - const client = createMockClient(data, query, variables);
    + const client = new ApolloClient({
    +   cache: new InMemoryCache(),
    +   link: new MockLink([
    +     {
    +       request: { query, variables },
    +       result: { data },
    +     }
    +   ]),
    + });

    mockObservableLink

    - const link = mockObservableLink();
    + const link = new MockSubscriptionLink();

    mockSingleLink

    - const link = mockSingleLink({
    -   request: { query, variables },
    -   result: { data },
    - });
    + const link = new MockLink([
    +   {
    +     request: { query, variables },
    +     result: { data },
    +   }
    + ]);
  • #12637 d2a60d4 Thanks @phryneas! - useQuery: only advance previousData if data actually changed

  • #12631 b147cac Thanks @phryneas! - ObservableQuery will now return a loading: false state for fetchPolicy standby, even before subscription

  • #12639 1bdf489 Thanks @jerelmiller! - Remove the @apollo/client/testing/core entrypoint in favor of @apollo/client/testing.

Minor Changes

  • #12639 1bdf489 Thanks @jerelmiller! - Move MockLink types to MockLink namespace. This affects the MockedResponse, MockLinkOptions, and ResultFunction types. These types are still exported but are deprecated in favor of the namespace. To migrate, use the types on the MockLink namespace instead.

    import {
    - MockedResponse,
    - MockLinkOptions,
    - ResultFunction,
    + MockLink
    } from "@apollo/client/testing";
    
    - const mocks: MockedResponse = [];
    + const mocks: MockLink.MockedResponse = [];
    
    - const result: ResultFunction = () => {/* ... */ }
    + const result: MockLink.ResultFunction = () => {/* ... */ }
    
    - const options: MockLinkOptions = {}
    + const options: MockLink.Options = {}

Patch Changes

  • #12631 b147cac Thanks @phryneas! - When updating skip from false to true in useQuery, retain data if it is available rather than setting it to undefined.

  • #12631 b147cac Thanks @phryneas! - The error property is no longer present when skip is true in useQuery.

Don't miss a new client release

NewReleases is sending notifications on new releases.