Skip to content

Commit

Permalink
Merge branch 'main' into pr/rules-of-hooks/useLazyQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas authored May 21, 2024
2 parents 86648f2 + 8740f19 commit 5f962c9
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 133 deletions.
13 changes: 10 additions & 3 deletions .api-reports/api-report-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,11 @@ class Concast<T> extends Observable<T> {
// @public (undocumented)
type ConcastSourcesIterable<T> = Iterable<Source<T>>;

// @internal (undocumented)
type CovariantUnaryFunction<out Arg, out Ret> = {
fn(arg: Arg): Ret;
}["fn"];

// Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "NormalizedCacheObject" needs to be exported by the entry point index.d.ts
//
Expand Down Expand Up @@ -954,7 +959,7 @@ interface MockedProviderState {
}

// @public (undocumented)
export interface MockedResponse<TData = Record<string, any>, TVariables = Record<string, any>> {
export interface MockedResponse<out TData = Record<string, any>, out TVariables = Record<string, any>> {
// (undocumented)
delay?: number;
// (undocumented)
Expand Down Expand Up @@ -1552,8 +1557,10 @@ interface Resolvers {
};
}

// Warning: (ae-forgotten-export) The symbol "CovariantUnaryFunction" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type ResultFunction<T, V = Record<string, any>> = (variables: V) => T;
export type ResultFunction<T, V = Record<string, any>> = CovariantUnaryFunction<V, T>;

// @public (undocumented)
type SafeReadonly<T> = T extends object ? Readonly<T> : T;
Expand Down Expand Up @@ -1698,7 +1705,7 @@ interface UriFunction {
}

// @public (undocumented)
type VariableMatcher<V = Record<string, any>> = (variables: V) => boolean;
type VariableMatcher<V = Record<string, any>> = CovariantUnaryFunction<V, boolean>;

// @public (undocumented)
export function wait(ms: number): Promise<void>;
Expand Down
13 changes: 10 additions & 3 deletions .api-reports/api-report-testing_core.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ class Concast<T> extends Observable<T> {
// @public (undocumented)
type ConcastSourcesIterable<T> = Iterable<Source<T>>;

// @internal (undocumented)
type CovariantUnaryFunction<out Arg, out Ret> = {
fn(arg: Arg): Ret;
}["fn"];

// Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "NormalizedCacheObject" needs to be exported by the entry point index.d.ts
//
Expand Down Expand Up @@ -909,7 +914,7 @@ interface MockApolloLink extends ApolloLink {
}

// @public (undocumented)
export interface MockedResponse<TData = Record<string, any>, TVariables = Record<string, any>> {
export interface MockedResponse<out TData = Record<string, any>, out TVariables = Record<string, any>> {
// (undocumented)
delay?: number;
// (undocumented)
Expand Down Expand Up @@ -1509,8 +1514,10 @@ interface Resolvers {
};
}

// Warning: (ae-forgotten-export) The symbol "CovariantUnaryFunction" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type ResultFunction<T, V = Record<string, any>> = (variables: V) => T;
export type ResultFunction<T, V = Record<string, any>> = CovariantUnaryFunction<V, T>;

// @public (undocumented)
type SafeReadonly<T> = T extends object ? Readonly<T> : T;
Expand Down Expand Up @@ -1655,7 +1662,7 @@ interface UriFunction {
}

// @public (undocumented)
type VariableMatcher<V = Record<string, any>> = (variables: V) => boolean;
type VariableMatcher<V = Record<string, any>> = CovariantUnaryFunction<V, boolean>;

// @public (undocumented)
export function wait(ms: number): Promise<void>;
Expand Down
5 changes: 5 additions & 0 deletions .changeset/late-days-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Fixes [#11849](https://github.com/apollographql/apollo-client/issues/11849) by reevaluating `window.fetch` each time `BatchHttpLink` uses it, if not configured via `options.fetch`. Takes the same approach as PR [#8603](https://github.com/apollographql/apollo-client/pull/8603) which fixed the same issue in `HttpLink`.
5 changes: 5 additions & 0 deletions .changeset/nasty-pens-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Ensure covariant behavior: `MockedResponse<X,Y>` should be assignable to `MockedResponse`
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

Lint:
docker:
- image: cimg/node:22.1.0
- image: cimg/node:22.2.0
steps:
- checkout
- run: npm version
Expand All @@ -24,15 +24,15 @@ jobs:

Formatting:
docker:
- image: cimg/node:22.1.0
- image: cimg/node:22.2.0
steps:
- checkout
- run: npm ci
- run: npm run check:format

Tests:
docker:
- image: cimg/node:22.1.0
- image: cimg/node:22.2.0
steps:
- checkout
- run: npm run ci:precheck
Expand All @@ -50,7 +50,7 @@ jobs:

BuildTarball:
docker:
- image: cimg/node:22.1.0
- image: cimg/node:22.2.0
steps:
- checkout
- run: npm run ci:precheck
Expand All @@ -69,7 +69,7 @@ jobs:
react:
type: string
docker:
- image: cimg/node:22.1.0
- image: cimg/node:22.2.0
steps:
- checkout
- attach_workspace:
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
externalPackage:
type: string
docker:
- image: cimg/node:22.1.0
- image: cimg/node:22.2.0
steps:
- checkout
- attach_workspace:
Expand Down
2 changes: 1 addition & 1 deletion .size-limits.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"dist/apollo-client.min.cjs": 39607,
"dist/apollo-client.min.cjs": 39574,
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32821
}
Loading

0 comments on commit 5f962c9

Please sign in to comment.