Skip to content

Commit

Permalink
Pass QueryInfo to fetchQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Dec 26, 2024
1 parent 7eb4e9c commit 6b49bd7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/core/ObservableQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`,
}

return this.queryManager
.fetchQuery(qid, combinedOptions, NetworkStatus.fetchMore)
.fetchQuery(queryInfo, combinedOptions, NetworkStatus.fetchMore)
.then((fetchMoreResult) => {
this.queryManager.removeQuery(qid);

Expand Down
14 changes: 7 additions & 7 deletions src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,15 +656,12 @@ export class QueryManager<TStore> {
}

public fetchQuery<TData, TVars extends OperationVariables>(
queryId: string,
queryInfo: QueryInfo,
options: WatchQueryOptions<TVars, TData>,
networkStatus?: NetworkStatus
): Promise<ApolloQueryResult<TData>> {
return this.fetchConcastWithInfo(
this.getQuery(queryId),
options,
networkStatus
).concast.promise as TODO;
return this.fetchConcastWithInfo(queryInfo, options, networkStatus).concast
.promise as TODO;
}

public getQueryStore() {
Expand Down Expand Up @@ -825,7 +822,10 @@ export class QueryManager<TStore> {

const query = this.transform(options.query);

return this.fetchQuery<TData, TVars>(queryId, { ...options, query })
return this.fetchQuery<TData, TVars>(this.getQuery(queryId), {
...options,
query,
})
.then(
(result) =>
result && {
Expand Down
6 changes: 3 additions & 3 deletions src/core/__tests__/QueryManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3810,7 +3810,7 @@ describe("QueryManager", () => {

const queryId = "1";
queryManager
.fetchQuery(queryId, { query })
.fetchQuery(queryManager.getQuery(queryId), { query })
.catch((e) => reject("Exception thrown for stopped query"));

queryManager.removeQuery(queryId);
Expand Down Expand Up @@ -3840,7 +3840,7 @@ describe("QueryManager", () => {
delay: 10000, //i.e. forever
});
queryManager
.fetchQuery("made up id", { query })
.fetchQuery(queryManager.getQuery("made up id"), { query })
.then(() => {
reject(new Error("Returned a result."));
})
Expand Down Expand Up @@ -4325,7 +4325,7 @@ describe("QueryManager", () => {
delay: 100,
});
queryManager
.fetchQuery("made up id", { query })
.fetchQuery(queryManager.getQuery("made up id"), { query })
.then(resolve)
.catch((error) => {
reject(new Error("Should not return an error"));
Expand Down

0 comments on commit 6b49bd7

Please sign in to comment.