Skip to content

Commit 3bdce02

Browse files
committed
Create mechanism to add experimental features to Apollo Client
1 parent 4d3fb77 commit 3bdce02

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

.changeset/olive-queens-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@apollo/client": patch
3+
---
4+
5+
Create mechanism to add experimental features to Apollo Client

src/core/ApolloClient.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ export declare namespace ApolloClient {
132132
* queries.
133133
*/
134134
incrementalHandler?: Incremental.Handler<any>;
135+
136+
experiments?: ApolloClient.Experiment[];
135137
}
136138

137139
interface DevtoolsOptions {
@@ -610,6 +612,10 @@ export declare namespace ApolloClient {
610612
variables?: TVariables;
611613
}
612614
}
615+
616+
export interface Experiment {
617+
(this: ApolloClient, options: ApolloClient.Options): void;
618+
}
613619
}
614620

615621
/**
@@ -708,6 +714,7 @@ export class ApolloClient {
708714
dataMasking,
709715
link,
710716
incrementalHandler = new NotImplementedHandler(),
717+
experiments = [],
711718
} = options;
712719

713720
this.link = link;
@@ -759,6 +766,8 @@ export class ApolloClient {
759766
}
760767

761768
if (this.devtoolsConfig.enabled) this.connectToDevTools();
769+
770+
experiments.forEach((experiment) => experiment.call(this, options));
762771
}
763772

764773
private connectToDevTools() {

0 commit comments

Comments
 (0)