Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions .api-reports/api-report-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,16 @@ export { execute }
export { fallbackHttpConfig }

// @public (undocumented)
export interface FetchMoreOptions<TData = unknown, TVariables = OperationVariables> {
// (undocumented)
updateQuery?: (previousQueryResult: TData, options: {
fetchMoreResult?: TData;
variables?: TVariables;
}) => TData;
}

// @public (undocumented)
export interface FetchMoreQueryOptions<TVariables, TData = unknown> {
// (undocumented)
export type FetchMoreOptions<TData, TVariables extends OperationVariables, TFetchData = TData, TFetchVars extends OperationVariables = TVariables> = {
query?: DocumentNode_2 | TypedDocumentNode<TFetchData, TFetchVars>;
variables?: Partial<NoInfer<TFetchVars>>;
errorPolicy?: ErrorPolicy;
context?: DefaultContext;
query?: DocumentNode_2 | TypedDocumentNode<TData, TVariables>;
variables?: Partial<NoInfer_2<TVariables>>;
}
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
fetchMoreResult: Unmasked<TFetchData>;
variables: TFetchVars;
}) => Unmasked<TData>;
};

// @public
export type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache";
Expand Down Expand Up @@ -588,12 +583,7 @@ export class ObservableQuery<TData = unknown, TVariables extends OperationVariab
});
// @internal @deprecated (undocumented)
applyOptions(newOptions: Partial<ObservableQuery.Options<TData, TVariables>>): void;
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
fetchMoreResult: Unmasked<TFetchData>;
variables: TFetchVars;
}) => Unmasked<TData>;
}): Promise<QueryResult<TFetchData>>;
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>({ query, variables, context, errorPolicy, updateQuery, }: FetchMoreOptions<TData, TVariables, TFetchData, TFetchVars>): Promise<QueryResult<TFetchData>>;
// @internal @deprecated (undocumented)
getCacheDiff({ optimistic }?: {
optimistic?: boolean | undefined;
Expand Down Expand Up @@ -1041,10 +1031,10 @@ export type WatchQueryOptions<TVariables extends OperationVariables = OperationV

// Warnings were encountered during analysis:
//
// src/core/ObservableQuery.ts:133:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:293:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:143:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:303:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:187:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:261:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:253:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
63 changes: 26 additions & 37 deletions .api-reports/api-report-react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { DocumentTransform } from '@apollo/client/utilities';
import type { ErrorLike as ErrorLike_2 } from '@apollo/client';
import type { ErrorPolicy as ErrorPolicy_2 } from '@apollo/client';
import type { FetchMoreFunction } from '@apollo/client/react/internal';
import type { FetchMoreQueryOptions as FetchMoreQueryOptions_2 } from '@apollo/client';
import type { FetchMoreOptions as FetchMoreOptions_2 } from '@apollo/client';
import type { FetchPolicy as FetchPolicy_2 } from '@apollo/client';
import type { FetchResult } from '@apollo/client/link';
import type { FormattedExecutionResult } from 'graphql';
Expand Down Expand Up @@ -290,12 +290,16 @@ interface ErrorLike {
type ErrorPolicy = "none" | "ignore" | "all";

// @public (undocumented)
interface FetchMoreQueryOptions<TVariables, TData = unknown> {
// (undocumented)
type FetchMoreOptions<TData, TVariables extends OperationVariables_2, TFetchData = TData, TFetchVars extends OperationVariables_2 = TVariables> = {
query?: DocumentNode | TypedDocumentNode<TFetchData, TFetchVars>;
variables?: Partial<NoInfer<TFetchVars>>;
errorPolicy?: ErrorPolicy;
context?: DefaultContext;
query?: DocumentNode | TypedDocumentNode<TData, TVariables>;
variables?: Partial<NoInfer_2<TVariables>>;
}
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
fetchMoreResult: Unmasked<TFetchData>;
variables: TFetchVars;
}) => Unmasked<TData>;
};

// @public
type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache";
Expand Down Expand Up @@ -562,13 +566,8 @@ class ObservableQuery<TData = unknown, TVariables extends OperationVariables_2 =
});
// @internal @deprecated (undocumented)
applyOptions(newOptions: Partial<ObservableQuery.Options<TData, TVariables>>): void;
// Warning: (ae-forgotten-export) The symbol "FetchMoreQueryOptions" needs to be exported by the entry point index.d.ts
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables_2 = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
fetchMoreResult: Unmasked<TFetchData>;
variables: TFetchVars;
}) => Unmasked<TData>;
}): Promise<QueryResult_2<TFetchData>>;
// Warning: (ae-forgotten-export) The symbol "FetchMoreOptions" needs to be exported by the entry point index.d.ts
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables_2 = TVariables>({ query, variables, context, errorPolicy, updateQuery, }: FetchMoreOptions<TData, TVariables, TFetchData, TFetchVars>): Promise<QueryResult_2<TFetchData>>;
// @internal @deprecated (undocumented)
getCacheDiff({ optimistic }?: {
optimistic?: boolean | undefined;
Expand Down Expand Up @@ -1225,12 +1224,7 @@ export namespace useLazyQuery {
subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
updateQuery: (mapFn: UpdateQueryMapFn_2<TData, TVariables>) => void;
refetch: (variables?: Partial<TVariables>) => Promise<QueryResult_3<MaybeMasked_2<TData>>>;
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions_2<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: Unmasked_2<TData>, options: {
fetchMoreResult: Unmasked_2<TFetchData>;
variables: TFetchVars;
}) => Unmasked_2<TData>;
}) => Promise<QueryResult_3<MaybeMasked_2<TFetchData>>>;
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreOptions_2<TData, TVariables, TFetchData, TFetchVars>) => Promise<QueryResult_3<MaybeMasked_2<TFetchData>>>;
client: ApolloClient;
observable: ObservableQuery_2<TData, TVariables>;
previousData?: MaybeMasked_2<TData>;
Expand Down Expand Up @@ -1410,12 +1404,7 @@ export namespace useQuery {
updateQuery: (mapFn: UpdateQueryMapFn_2<TData, TVariables>) => void;
refetch: (variables?: Partial<TVariables>) => Promise<QueryResult_3<MaybeMasked<TData>>>;
variables: TVariables;
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions_2<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
fetchMoreResult: Unmasked<TFetchData>;
variables: TFetchVars;
}) => Unmasked<TData>;
}) => Promise<QueryResult_3<MaybeMasked<TFetchData>>>;
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreOptions_2<TData, TVariables, TFetchData, TFetchVars>) => Promise<QueryResult_3<MaybeMasked<TFetchData>>>;
} & GetDataState_2<MaybeMasked<TData>, TStates>;
}

Expand Down Expand Up @@ -1640,23 +1629,23 @@ type WatchQueryOptions_2<TVariables extends OperationVariables_2 = OperationVari

// Warnings were encountered during analysis:
//
// src/core/ObservableQuery.ts:133:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:145:5 - (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:293:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:63:3 - (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:143:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:155:5 - (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:303:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:187:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/types.ts:236:3 - (ae-forgotten-export) The symbol "ErrorLike" needs to be exported by the entry point index.d.ts
// src/core/types.ts:238:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts
// src/core/types.ts:255:7 - (ae-forgotten-export) The symbol "Streaming" needs to be exported by the entry point index.d.ts
// src/core/types.ts:308:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:186:3 - (ae-forgotten-export) The symbol "UpdateQueryOptions" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:261:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:269:3 - (ae-forgotten-export) The symbol "MutationQueryReducersMap" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:272:3 - (ae-forgotten-export) The symbol "NormalizedExecutionResult" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:282:3 - (ae-forgotten-export) The symbol "MutationUpdaterFunction" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:285:3 - (ae-forgotten-export) The symbol "OnQueryUpdated" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:288:3 - (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:294:3 - (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts
// src/react/hooks/useLoadableQuery.ts:71:7 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:178:3 - (ae-forgotten-export) The symbol "UpdateQueryOptions" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:253:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:261:3 - (ae-forgotten-export) The symbol "MutationQueryReducersMap" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:264:3 - (ae-forgotten-export) The symbol "NormalizedExecutionResult" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:274:3 - (ae-forgotten-export) The symbol "MutationUpdaterFunction" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:277:3 - (ae-forgotten-export) The symbol "OnQueryUpdated" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:286:3 - (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts
// src/react/hooks/useLoadableQuery.ts:70:7 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useSuspenseFragment.ts:75:5 - (ae-forgotten-export) The symbol "From" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
Expand Down
17 changes: 3 additions & 14 deletions .api-reports/api-report-react_internal.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import type { createQueryPreloader } from '@apollo/client/react';
import type { DataState } from '@apollo/client';
import type { DecoratedPromise } from '@apollo/client/utilities/internal';
import type { DocumentNode } from 'graphql';
import type { FetchMoreQueryOptions } from '@apollo/client';
import type { FetchMoreOptions } from '@apollo/client';
import type { MaybeMasked } from '@apollo/client/masking';
import type { MaybeMasked as MaybeMasked_2 } from '@apollo/client';
import type { Observable } from 'rxjs';
import type { ObservableQuery } from '@apollo/client';
import type { OperationVariables } from '@apollo/client';
import type { QueryResult } from '@apollo/client';
import type { Unmasked } from '@apollo/client';
import type { useBackgroundQuery } from '@apollo/client/react';
import type { useFragment } from '@apollo/client/react';
import type { useQuery } from '@apollo/client/react';
Expand Down Expand Up @@ -46,15 +45,7 @@ stringifiedVariables: string,
];

// @public (undocumented)
export type FetchMoreFunction<TData, TVariables extends OperationVariables> = (fetchMoreOptions: FetchMoreQueryOptions<TVariables, TData> & {
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
fetchMoreResult: Unmasked<TData>;
variables: TVariables;
}) => Unmasked<TData>;
}) => Promise<QueryResult<MaybeMasked_2<TData>>>;

// @public (undocumented)
type FetchMoreOptions<TData> = Parameters<ObservableQuery<TData>["fetchMore"]>[0];
export type FetchMoreFunction<TData, TVariables extends OperationVariables> = <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreOptions<TData, TVariables, TFetchData, TFetchVars>) => Promise<QueryResult<MaybeMasked_2<TData>>>;

// @public (undocumented)
type FragmentCacheKey = [
Expand Down Expand Up @@ -138,10 +129,8 @@ export class InternalQueryReference<TData = unknown, TStates extends DataState<T
didChangeOptions(watchQueryOptions: ObservedOptions): boolean;
// (undocumented)
get disposed(): boolean;
// Warning: (ae-forgotten-export) The symbol "FetchMoreOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
fetchMore(options: FetchMoreOptions<TData>): Promise<QueryResult<TData>>;
fetchMore(options: FetchMoreOptions<TData, any, any, any>): Promise<QueryResult<TData>>;
// (undocumented)
readonly key: QueryKey;
// Warning: (ae-forgotten-export) The symbol "Listener" needs to be exported by the entry point index.d.ts
Expand Down
38 changes: 14 additions & 24 deletions .api-reports/api-report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,22 +842,16 @@ export const fallbackHttpConfig: {
};

// @public (undocumented)
export interface FetchMoreOptions<TData = unknown, TVariables = OperationVariables> {
// (undocumented)
updateQuery?: (previousQueryResult: TData, options: {
fetchMoreResult?: TData;
variables?: TVariables;
}) => TData;
}

// @public (undocumented)
export interface FetchMoreQueryOptions<TVariables, TData = unknown> {
// (undocumented)
export type FetchMoreOptions<TData, TVariables extends OperationVariables, TFetchData = TData, TFetchVars extends OperationVariables = TVariables> = {
query?: DocumentNode | TypedDocumentNode<TFetchData, TFetchVars>;
variables?: Partial<NoInfer<TFetchVars>>;
errorPolicy?: ErrorPolicy;
context?: DefaultContext;
query?: DocumentNode | TypedDocumentNode<TData, TVariables>;
// Warning: (ae-forgotten-export) The symbol "NoInfer_2" needs to be exported by the entry point index.d.ts
variables?: Partial<NoInfer_2<TVariables>>;
}
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
fetchMoreResult: Unmasked<TFetchData>;
variables: TFetchVars;
}) => Unmasked<TData>;
};

// @public
export type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache";
Expand Down Expand Up @@ -1522,6 +1516,7 @@ namespace LocalState {
//
// @public (undocumented)
class LocalState<TResolvers extends LocalState.Resolvers = LocalState.Resolvers<DefaultContext>, TContext = InferContextValueFromResolvers<TResolvers>> {
// Warning: (ae-forgotten-export) The symbol "NoInfer_2" needs to be exported by the entry point index.d.ts
constructor(...[options]: {} extends TResolvers ? [
options?: LocalState.Options<TResolvers, NoInfer_2<TContext>>
] : [
Expand Down Expand Up @@ -1908,12 +1903,7 @@ export class ObservableQuery<TData = unknown, TVariables extends OperationVariab
});
// @internal @deprecated (undocumented)
applyOptions(newOptions: Partial<ObservableQuery.Options<TData, TVariables>>): void;
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
fetchMoreResult: Unmasked<TFetchData>;
variables: TFetchVars;
}) => Unmasked<TData>;
}): Promise<QueryResult<TFetchData>>;
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>({ query, variables, context, errorPolicy, updateQuery, }: FetchMoreOptions<TData, TVariables, TFetchData, TFetchVars>): Promise<QueryResult<TFetchData>>;
// @internal @deprecated (undocumented)
getCacheDiff({ optimistic }?: {
optimistic?: boolean | undefined;
Expand Down Expand Up @@ -2701,10 +2691,10 @@ interface WriteContext extends ReadMergeModifyContext {
// src/cache/inmemory/policies.ts:166:3 - (ae-forgotten-export) The symbol "KeySpecifier" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/policies.ts:166:3 - (ae-forgotten-export) The symbol "KeyArgsFunction" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/types.ts:133:3 - (ae-forgotten-export) The symbol "KeyFieldsFunction" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:133:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:293:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:143:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:303:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:187:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:261:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:253:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
// src/local-state/LocalState.ts:140:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/local-state/LocalState.ts:174:7 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/local-state/LocalState.ts:194:7 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
Expand Down
6 changes: 6 additions & 0 deletions .changeset/mighty-carrots-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@apollo/client": minor
---

Allow passing `errorPolicy` option to `fetchMore` and change default value to "none".

Loading