Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f1b483d
Enter prerelease mode
github-actions[bot] Sep 4, 2025
2be8de2
Create mechanism to add experimental features to Apollo Client (#12915)
phryneas Sep 24, 2025
96b531f
More robust handling of local state default value when read function …
jerelmiller Sep 26, 2025
303e72d
Version Packages (alpha) (#12940)
github-actions[bot] Sep 26, 2025
bb8ed7b
Throw an error when using `@stream` without a configured `incremental…
jerelmiller Oct 10, 2025
785e223
Add `context` as callback to `useMutation` `mutate` function (#12959)
jerelmiller Oct 10, 2025
257eb18
Version Packages (alpha) (#12962)
github-actions[bot] Oct 10, 2025
5776ea0
Update `accept` header used with `GraphQL17Alpha9Handler` (#12973)
jerelmiller Oct 21, 2025
4631175
Ignore `data` values set in subsequent chunks in incremental response…
jerelmiller Oct 27, 2025
45ebb52
Add array support to `useFragment`, `useSuspenseFragment`, and `clien…
jerelmiller Oct 27, 2025
6d0b989
Version Packages (alpha) (#12977)
github-actions[bot] Oct 27, 2025
259ae9b
Allow `FragmentType` to be called as `FragmentType<TypedDocumentNode>…
phryneas Nov 13, 2025
44706a2
Add helper type QueryRef.ForQuery<TypedDocumentNode> (#13012)
phryneas Nov 14, 2025
410ceec
Update React Compiler to 1.0.0 (#13004)
phryneas Nov 14, 2025
2b7f2c1
Add support for the new incremental format in GraphQL 17.0.0-alpha.9 …
jerelmiller Nov 14, 2025
2e224b9
Add support for `@stream` (#12918)
jerelmiller Nov 14, 2025
94ea3e3
Improve handling of arrays in `@defer` and `@stream` payloads (#12923)
jerelmiller Nov 14, 2025
5851800
Ensure using `@defer` or `@stream` with `fetchMore` rerenders with in…
jerelmiller Nov 14, 2025
c4b52c9
Version Packages (alpha) (#12928)
github-actions[bot] Sep 17, 2025
2ad6c0d
Merge remote-tracking branch 'origin/main' into release-4.1
jerelmiller Nov 17, 2025
a617c10
Version Packages (alpha) (#13011)
github-actions[bot] Nov 17, 2025
7627000
Feedback from open incremental PRs (#13010)
jerelmiller Nov 19, 2025
b0f9f97
Version Packages (alpha) (#13025)
github-actions[bot] Nov 19, 2025
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
55 changes: 49 additions & 6 deletions .api-reports/api-report-cache.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import { getApolloCacheMemoryInternals } from '@apollo/client/utilities/internal
import type { GetDataState } from '@apollo/client';
import { getInMemoryCacheMemoryInternals } from '@apollo/client/utilities/internal';
import type { InlineFragmentNode } from 'graphql';
import type { IsAny } from '@apollo/client/utilities/internal';
import { isReference } from '@apollo/client/utilities';
import type { NoInfer as NoInfer_2 } from '@apollo/client/utilities/internal';
import { Observable } from 'rxjs';
import type { OperationVariables } from '@apollo/client';
import type { Prettify } from '@apollo/client/utilities/internal';
import { Reference } from '@apollo/client/utilities';
import type { SelectionSetNode } from 'graphql';
import type { StoreObject } from '@apollo/client/utilities';
Expand All @@ -39,20 +41,36 @@ type AllFieldsModifier<Entity extends Record<string, any>> = Modifier<Entity[key

// @public (undocumented)
export namespace ApolloCache {
// (undocumented)
export interface ObservableFragment<TData = unknown> extends Observable<ApolloCache.WatchFragmentResult<TData>> {
getCurrentResult: () => ApolloCache.WatchFragmentResult<TData>;
}
export type WatchFragmentFromValue<TData> = StoreObject | Reference | FragmentType<NoInfer_2<TData>> | string | null;
export interface WatchFragmentOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
fragmentName?: string;
from: StoreObject | Reference | FragmentType<NoInfer_2<TData>> | string;
from: ApolloCache.WatchFragmentFromValue<TData> | Array<ApolloCache.WatchFragmentFromValue<TData>>;
optimistic?: boolean;
variables?: TVariables;
}
export type WatchFragmentResult<TData = unknown> = ({
export type WatchFragmentResult<TData = unknown> = true extends IsAny<TData> ? ({
complete: true;
missing?: never;
} & GetDataState<any, "complete">) | ({
complete: false;
missing?: MissingTree;
} & GetDataState<any, "partial">) : TData extends null | null[] ? Prettify<{
complete: true;
missing?: never;
} & GetDataState<TData, "complete">> : Prettify<{
complete: true;
missing?: never;
} & GetDataState<TData, "complete">) | ({
} & GetDataState<TData, "complete">> | {
complete: false;
missing: MissingTree;
} & GetDataState<TData, "partial">);
missing?: MissingTree;
data: TData extends Array<infer TItem> ? Array<DataValue.Partial<TItem> | null> : DataValue.Partial<TData>;
dataState: "partial";
};
}

// @public (undocumented)
Expand All @@ -77,6 +95,7 @@ export abstract class ApolloCache {
lookupFragment(fragmentName: string): FragmentDefinitionNode | null;
// (undocumented)
modify<Entity extends Record<string, any> = Record<string, any>>(options: Cache_2.ModifyOptions<Entity>): boolean;
protected onAfterBroadcast: (cb: () => void) => void;
// (undocumented)
abstract performTransaction(transaction: Transaction, optimisticId?: string | null): void;
// (undocumented)
Expand All @@ -94,6 +113,7 @@ export abstract class ApolloCache {
abstract removeOptimistic(id: string): void;
// (undocumented)
abstract reset(options?: Cache_2.ResetOptions): Promise<void>;
resolvesClientField?(typename: string, fieldName: string): boolean;
abstract restore(serializedState: unknown): this;
// (undocumented)
transformDocument(document: DocumentNode): DocumentNode;
Expand All @@ -105,7 +125,28 @@ export abstract class ApolloCache {
updateQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: Cache_2.UpdateQueryOptions<TData, TVariables>, update: (data: Unmasked<TData> | null) => Unmasked<TData> | null | void): Unmasked<TData> | null;
// (undocumented)
abstract watch<TData = unknown, TVariables extends OperationVariables = OperationVariables>(watch: Cache_2.WatchOptions<TData, TVariables>): () => void;
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloCache.WatchFragmentOptions<TData, TVariables>): Observable<ApolloCache.WatchFragmentResult<Unmasked<TData>>>;
// (undocumented)
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloCache.WatchFragmentOptions<TData, TVariables> & {
from: Array<NonNullable<ApolloCache.WatchFragmentFromValue<TData>>>;
}): ApolloCache.ObservableFragment<Array<Unmasked<TData>>>;
// (undocumented)
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloCache.WatchFragmentOptions<TData, TVariables> & {
from: Array<null>;
}): ApolloCache.ObservableFragment<Array<null>>;
// (undocumented)
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloCache.WatchFragmentOptions<TData, TVariables> & {
from: Array<ApolloCache.WatchFragmentFromValue<TData>>;
}): ApolloCache.ObservableFragment<Array<Unmasked<TData> | null>>;
// (undocumented)
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloCache.WatchFragmentOptions<TData, TVariables> & {
from: null;
}): ApolloCache.ObservableFragment<null>;
// (undocumented)
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloCache.WatchFragmentOptions<TData, TVariables> & {
from: NonNullable<ApolloCache.WatchFragmentFromValue<TData>>;
}): ApolloCache.ObservableFragment<Unmasked<TData>>;
// (undocumented)
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloCache.WatchFragmentOptions<TData, TVariables>): ApolloCache.ObservableFragment<Unmasked<TData> | null>;
// (undocumented)
abstract write<TData = unknown, TVariables extends OperationVariables = OperationVariables>(write: Cache_2.WriteOptions<TData, TVariables>): Reference | undefined;
writeFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>({ data, fragment, fragmentName, variables, overwrite, id, broadcast, }: Cache_2.WriteFragmentOptions<TData, TVariables>): Reference | undefined;
Expand Down Expand Up @@ -544,6 +585,8 @@ export class InMemoryCache extends ApolloCache {
// (undocumented)
reset(options?: Cache_2.ResetOptions): Promise<void>;
// (undocumented)
resolvesClientField(typename: string, fieldName: string): boolean;
// (undocumented)
restore(data: NormalizedCacheObject): this;
// (undocumented)
retain(rootId: string, optimistic?: boolean): number;
Expand Down
36 changes: 32 additions & 4 deletions .api-reports/api-report-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ export namespace ApolloClient {
}
}
// (undocumented)
export interface Experiment {
// (undocumented)
(this: ApolloClient, options: ApolloClient.Options): void;
// (undocumented)
v: 1;
}
// (undocumented)
export type MutateOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables, TCache extends ApolloCache = ApolloCache> = {
optimisticResponse?: Unmasked<NoInfer<TData>> | ((vars: TVariables, { IGNORE }: {
IGNORE: IgnoreModifier;
Expand All @@ -217,6 +224,10 @@ export namespace ApolloClient {
extensions?: Record<string, unknown>;
}
// (undocumented)
export interface ObservableFragment<TData = unknown> extends Observable_2<ApolloClient.WatchFragmentResult<TData>> {
getCurrentResult: () => ApolloClient.WatchFragmentResult<TData>;
}
// (undocumented)
export interface Options {
assumeImmutableResults?: boolean;
cache: ApolloCache;
Expand All @@ -231,6 +242,7 @@ export namespace ApolloClient {
documentTransform?: DocumentTransform;
// (undocumented)
enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;
experiments?: ApolloClient.Experiment[];
incrementalHandler?: Incremental.Handler<any>;
link: ApolloLink;
// (undocumented)
Expand Down Expand Up @@ -287,7 +299,7 @@ export namespace ApolloClient {
// (undocumented)
export type WatchFragmentOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = ApolloCache.WatchFragmentOptions<TData, TVariables>;
// (undocumented)
export type WatchFragmentResult<TData = unknown> = ApolloCache.WatchFragmentResult<TData>;
export type WatchFragmentResult<TData = unknown> = ApolloCache.WatchFragmentResult<MaybeMasked<TData>>;
export type WatchQueryOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
fetchPolicy?: WatchQueryFetchPolicy;
nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TData, TVariables>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
Expand Down Expand Up @@ -359,7 +371,23 @@ export class ApolloClient {
subscribe<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.SubscribeOptions<TData, TVariables>): SubscriptionObservable<ApolloClient.SubscribeResult<MaybeMasked<TData>>>;
// (undocumented)
version: string;
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables>): Observable_2<ApolloClient.WatchFragmentResult<MaybeMasked<TData>>>;
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
from: Array<NonNullable<ApolloCache.WatchFragmentFromValue<TData>>>;
}): ApolloClient.ObservableFragment<Array<TData>>;
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
from: Array<null>;
}): ApolloClient.ObservableFragment<Array<null>>;
// (undocumented)
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
from: Array<ApolloCache.WatchFragmentFromValue<TData>>;
}): ApolloClient.ObservableFragment<Array<TData | null>>;
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
from: null;
}): ApolloClient.ObservableFragment<null>;
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
from: NonNullable<ApolloCache.WatchFragmentFromValue<TData>>;
}): ApolloClient.ObservableFragment<TData>;
watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables>): ApolloClient.ObservableFragment<TData | null>;
watchQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchQueryOptions<TData, TVariables>): ObservableQuery<TData, TVariables>;
writeFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WriteFragmentOptions<TData, TVariables>): Reference_2 | undefined;
writeQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WriteQueryOptions<TData, TVariables>): Reference_2 | undefined;
Expand Down Expand Up @@ -1132,8 +1160,8 @@ export type WatchQueryOptions<TVariables extends OperationVariables = OperationV

// Warnings were encountered during analysis:
//
// src/core/ApolloClient.ts:353:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:361:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ApolloClient.ts:370:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:368:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:180:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
Expand Down
123 changes: 118 additions & 5 deletions .api-reports/api-report-incremental.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,36 @@ namespace Defer20220824Handler {
return: Defer20220824Handler.Chunk<Record<string, unknown>>;
}
// (undocumented)
type IncrementalDeferPayload<TData = Record<string, unknown>> = {
data?: TData | null | undefined;
type IncrementalDeferResult<TData = Record<string, unknown>> = {
data?: TData | null;
errors?: ReadonlyArray<GraphQLFormattedError>;
extensions?: Record<string, unknown>;
path?: Incremental.Path;
label?: string;
};
// (undocumented)
type IncrementalResult<TData = Record<string, unknown>> = IncrementalDeferResult<TData> | IncrementalStreamResult<TData>;
// (undocumented)
type IncrementalStreamResult<TData = Array<unknown>> = {
errors?: ReadonlyArray<GraphQLFormattedError>;
items?: TData;
path?: Incremental.Path;
label?: string;
extensions?: Record<string, unknown>;
};
// (undocumented)
type InitialResult<TData = Record<string, unknown>> = {
data?: TData | null | undefined;
errors?: ReadonlyArray<GraphQLFormattedError>;
extensions?: Record<string, unknown>;
hasNext: boolean;
incremental?: ReadonlyArray<IncrementalResult<TData>>;
};
// (undocumented)
type SubsequentResult<TData = Record<string, unknown>> = {
data?: TData | null | undefined;
errors?: ReadonlyArray<GraphQLFormattedError>;
extensions?: Record<string, unknown>;
hasNext: boolean;
incremental?: Array<IncrementalDeferPayload<TData>>;
incremental?: Array<IncrementalResult<TData>>;
};
// (undocumented)
interface TypeOverrides {
Expand Down Expand Up @@ -80,6 +89,102 @@ class DeferRequest<TData extends Record<string, unknown>> implements Incremental
hasNext: boolean;
}

// @public (undocumented)
export namespace GraphQL17Alpha9Handler {
// (undocumented)
export type Chunk<TData> = InitialResult<TData> | SubsequentResult<TData>;
// (undocumented)
export interface CompletedResult {
// (undocumented)
errors?: ReadonlyArray<GraphQLFormattedError>;
// (undocumented)
id: string;
}
// (undocumented)
export interface GraphQL17Alpha9Result extends HKT {
// (undocumented)
arg1: unknown;
// (undocumented)
arg2: unknown;
// (undocumented)
return: GraphQL17Alpha9Handler.Chunk<Record<string, unknown>>;
}
// (undocumented)
export interface IncrementalDeferResult<TData = Record<string, unknown>> {
// (undocumented)
data: TData;
// (undocumented)
errors?: ReadonlyArray<GraphQLFormattedError>;
// (undocumented)
extensions?: Record<string, unknown>;
// (undocumented)
id: string;
// (undocumented)
subPath?: Incremental.Path;
}
// (undocumented)
export type IncrementalResult<TData = unknown> = IncrementalDeferResult<TData> | IncrementalStreamResult<TData>;
// (undocumented)
export interface IncrementalStreamResult<TData = ReadonlyArray<unknown>> {
// (undocumented)
errors?: ReadonlyArray<GraphQLFormattedError>;
// (undocumented)
extensions?: Record<string, unknown>;
// (undocumented)
id: string;
// (undocumented)
items: TData;
// (undocumented)
subPath?: Incremental.Path;
}
// (undocumented)
export type InitialResult<TData = Record<string, unknown>> = {
data: TData;
errors?: ReadonlyArray<GraphQLFormattedError>;
pending: ReadonlyArray<PendingResult>;
hasNext: boolean;
extensions?: Record<string, unknown>;
};
// (undocumented)
export interface PendingResult {
// (undocumented)
id: string;
// (undocumented)
label?: string;
// (undocumented)
path: Incremental.Path;
}
// (undocumented)
export type SubsequentResult<TData = unknown> = {
hasNext: boolean;
pending?: ReadonlyArray<PendingResult>;
incremental?: ReadonlyArray<IncrementalResult<TData>>;
completed?: ReadonlyArray<CompletedResult>;
extensions?: Record<string, unknown>;
};
// (undocumented)
export interface TypeOverrides {
// (undocumented)
AdditionalApolloLinkResultTypes: GraphQL17Alpha9Result;
}
}

// @public
export class GraphQL17Alpha9Handler implements Incremental.Handler<GraphQL17Alpha9Handler.Chunk<any>> {
// @internal @deprecated (undocumented)
extractErrors(result: ApolloLink.Result<any>): GraphQLFormattedError[] | undefined;
// @internal @deprecated (undocumented)
isIncrementalResult(result: ApolloLink.Result<any>): result is GraphQL17Alpha9Handler.InitialResult | GraphQL17Alpha9Handler.SubsequentResult;
// @internal @deprecated (undocumented)
prepareRequest(request: ApolloLink.Request): ApolloLink.Request;
// Warning: (ae-forgotten-export) The symbol "IncrementalRequest" needs to be exported by the entry point index.d.ts
//
// @internal @deprecated (undocumented)
startRequest<TData>(_: {
query: DocumentNode;
}): IncrementalRequest<TData>;
}

// @public (undocumented)
export namespace Incremental {
// @internal @deprecated (undocumented)
Expand All @@ -106,6 +211,14 @@ export namespace Incremental {
export type Path = ReadonlyArray<string | number>;
}

// @public (undocumented)
class IncrementalRequest<TData> implements Incremental.IncrementalRequest<GraphQL17Alpha9Handler.Chunk<TData>, TData> {
// (undocumented)
handle(cacheData: TData | DeepPartial<TData> | null | undefined, chunk: GraphQL17Alpha9Handler.Chunk<TData>): FormattedExecutionResult<TData>;
// (undocumented)
hasNext: boolean;
}

// @public (undocumented)
export namespace NotImplementedHandler {
// (undocumented)
Expand Down
4 changes: 3 additions & 1 deletion .api-reports/api-report-local-state.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { NoInfer as NoInfer_2 } from '@apollo/client/utilities/internal';
import type { OperationVariables } from '@apollo/client';
import type { RemoveIndexSignature } from '@apollo/client/utilities/internal';
import type { TypedDocumentNode } from '@apollo/client';
import type { WatchQueryFetchPolicy } from '@apollo/client';

// @public (undocumented)
type InferContextValueFromResolvers<TResolvers> = TResolvers extends {
Expand Down Expand Up @@ -91,14 +92,15 @@ export class LocalState<TResolvers extends LocalState.Resolvers = LocalState.Res
]);
addResolvers(resolvers: TResolvers): void;
// (undocumented)
execute<TData = unknown, TVariables extends OperationVariables = OperationVariables>({ document, client, context, remoteResult, variables, onlyRunForcedResolvers, returnPartialData, }: {
execute<TData = unknown, TVariables extends OperationVariables = OperationVariables>({ document, client, context, remoteResult, variables, onlyRunForcedResolvers, returnPartialData, fetchPolicy, }: {
document: DocumentNode | TypedDocumentNode<TData, TVariables>;
client: ApolloClient;
context: DefaultContext | undefined;
remoteResult: FormattedExecutionResult<any> | undefined;
variables: TVariables | undefined;
onlyRunForcedResolvers?: boolean;
returnPartialData?: boolean;
fetchPolicy: WatchQueryFetchPolicy;
}): Promise<FormattedExecutionResult<TData>>;
// (undocumented)
getExportedVariables<TVariables extends OperationVariables = OperationVariables>({ document, client, context, variables, }: {
Expand Down
Loading