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
2 changes: 0 additions & 2 deletions .api-reports/api-report-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,6 @@ class QueryManager {
}): ObservableAndInfo<TData>;
// (undocumented)
fetchQuery<TData, TVariables extends OperationVariables>(options: ApolloClient.WatchQueryOptions<TData, TVariables>, networkStatus?: NetworkStatus): Promise<ApolloClient.QueryResult<TData>>;
// (undocumented)
generateRequestId(): number;
// Warning: (ae-forgotten-export) The symbol "TransformCacheEntry" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand Down
2 changes: 0 additions & 2 deletions .api-reports/api-report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2443,8 +2443,6 @@ class QueryManager {
}): ObservableAndInfo<TData>;
// (undocumented)
fetchQuery<TData, TVariables extends OperationVariables>(options: ApolloClient.WatchQueryOptions<TData, TVariables>, networkStatus?: NetworkStatus): Promise<ApolloClient.QueryResult<TData>>;
// (undocumented)
generateRequestId(): number;
// Warning: (ae-forgotten-export) The symbol "TransformCacheEntry" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand Down
5 changes: 5 additions & 0 deletions .changeset/hip-clocks-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Cleanup some unused internals. Please file an issue if you notice anything change.
3 changes: 0 additions & 3 deletions src/core/QueryInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ export class QueryInfo<
TVariables extends OperationVariables = OperationVariables,
TCache extends ApolloCache = ApolloCache,
> {
// TODO remove soon - this should be able to be handled by cancelling old operations before starting new ones
lastRequestId = 1;

private cache: TCache;
private queryManager: Pick<
QueryManager,
Expand Down
13 changes: 1 addition & 12 deletions src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,6 @@ export class QueryManager {
}));
}

private requestIdCounter = 1;
public generateRequestId() {
return this.requestIdCounter++;
}

public clearStore(
options: Cache.ResetOptions = {
discardWatches: true,
Expand Down Expand Up @@ -1053,7 +1048,6 @@ export class QueryManager {
exposeExtensions?: boolean;
}
): Observable<ObservableQuery.Result<TData>> {
const requestId = (queryInfo.lastRequestId = this.generateRequestId());
const { errorPolicy } = options;

// Performing transformForLink here gives this.cache a chance to fill in
Expand Down Expand Up @@ -1107,10 +1101,6 @@ export class QueryManager {
aqr[extensionsSymbol] = result.extensions;
}

// In the case we start multiple network requests simultaneously, we
// want to ensure we properly set `data` if we're reporting on an old
// result which will not be caught by the conditional above that ends up
// throwing the markError result.
if (hasErrors) {
if (errorPolicy === "none") {
aqr.data = void 0 as TData;
Expand All @@ -1129,8 +1119,7 @@ export class QueryManager {
return aqr;
}),
catchError((error) => {
// Avoid storing errors from older interrupted queries.
if (requestId >= queryInfo.lastRequestId && errorPolicy === "none") {
if (errorPolicy === "none") {
queryInfo.resetLastWrite();
observableQuery?.["resetNotifications"]();
throw error;
Expand Down
Loading