Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve processing of options.nextFetchPolicy #8465

Merged
merged 11 commits into from
Jul 9, 2021
Merged
Prev Previous commit
Next Next commit
Improve type for QueryData["previous"]["observableQueryOptions"].
  • Loading branch information
benjamn committed Jul 9, 2021
commit bdac212592472dd040d6e7a902d052de26793ce7
9 changes: 6 additions & 3 deletions src/react/data/QueryData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import {
} from '../types/types';
import { OperationData } from './OperationData';

type ObservableQueryOptions<TData, TVars> =
ReturnType<QueryData<TData, TVars>["prepareObservableQueryOptions"]>;

export class QueryData<TData, TVariables> extends OperationData<
QueryDataOptions<TData, TVariables>
> {
Expand All @@ -39,7 +42,7 @@ export class QueryData<TData, TVariables> extends OperationData<
private previous: {
client?: ApolloClient<object>;
query?: DocumentNode | TypedDocumentNode<TData, TVariables>;
observableQueryOptions?: {};
observableQueryOptions?: ObservableQueryOptions<TData, TVariables>;
result?: QueryResult<TData, TVariables>;
loading?: boolean;
options?: QueryDataOptions<TData, TVariables>;
Expand Down Expand Up @@ -222,7 +225,7 @@ export class QueryData<TData, TVariables> extends OperationData<

this.previous.observableQueryOptions = {
...observableQueryOptions,
children: null
children: void 0,
};
this.currentObservable = this.refreshClient().client.watchQuery({
...observableQueryOptions
Expand All @@ -246,7 +249,7 @@ export class QueryData<TData, TVariables> extends OperationData<

const newObservableQueryOptions = {
...this.prepareObservableQueryOptions(),
children: null
children: void 0,
};

if (this.getOptions().skip) {
Expand Down