From bc055e0683e87b9445e321f73857f4a91b20a9ce Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Mon, 2 Oct 2023 19:18:22 +0200 Subject: [PATCH] Remove `QueryInfo.subscriptions` (dead code) (#11267) --- .api-reports/api-report-core.md | 2 -- .api-reports/api-report-react.md | 2 -- .api-reports/api-report-react_components.md | 2 -- .api-reports/api-report-react_context.md | 2 -- .api-reports/api-report-react_hoc.md | 2 -- .api-reports/api-report-react_hooks.md | 2 -- .api-reports/api-report-react_ssr.md | 2 -- .api-reports/api-report-testing.md | 2 -- .api-reports/api-report-testing_core.md | 2 -- .api-reports/api-report-utilities.md | 2 -- .api-reports/api-report.md | 2 -- .changeset/short-owls-breathe.md | 5 +++++ src/core/QueryInfo.ts | 4 ---- 13 files changed, 5 insertions(+), 26 deletions(-) create mode 100644 .changeset/short-owls-breathe.md diff --git a/.api-reports/api-report-core.md b/.api-reports/api-report-core.md index 0bc6fab994b..c5a2b4ae963 100644 --- a/.api-reports/api-report-core.md +++ b/.api-reports/api-report-core.md @@ -1666,8 +1666,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-react.md b/.api-reports/api-report-react.md index 3be6c342a55..1a92b739f41 100644 --- a/.api-reports/api-report-react.md +++ b/.api-reports/api-report-react.md @@ -1485,8 +1485,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-react_components.md b/.api-reports/api-report-react_components.md index cf07c01004a..10db9966b2e 100644 --- a/.api-reports/api-report-react_components.md +++ b/.api-reports/api-report-react_components.md @@ -1289,8 +1289,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-react_context.md b/.api-reports/api-report-react_context.md index fe5b3e684cb..aebf21eaa34 100644 --- a/.api-reports/api-report-react_context.md +++ b/.api-reports/api-report-react_context.md @@ -1199,8 +1199,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-react_hoc.md b/.api-reports/api-report-react_hoc.md index bcfbf8c55c5..60864f3b18a 100644 --- a/.api-reports/api-report-react_hoc.md +++ b/.api-reports/api-report-react_hoc.md @@ -1267,8 +1267,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-react_hooks.md b/.api-reports/api-report-react_hooks.md index 81729a792ce..8d503662330 100644 --- a/.api-reports/api-report-react_hooks.md +++ b/.api-reports/api-report-react_hooks.md @@ -1413,8 +1413,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-react_ssr.md b/.api-reports/api-report-react_ssr.md index 4e617cff33e..b1416f95526 100644 --- a/.api-reports/api-report-react_ssr.md +++ b/.api-reports/api-report-react_ssr.md @@ -1186,8 +1186,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-testing.md b/.api-reports/api-report-testing.md index 70b9d593258..90a4c964b6f 100644 --- a/.api-reports/api-report-testing.md +++ b/.api-reports/api-report-testing.md @@ -1262,8 +1262,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-testing_core.md b/.api-reports/api-report-testing_core.md index 2dc55496b8d..6dd0aaf3bae 100644 --- a/.api-reports/api-report-testing_core.md +++ b/.api-reports/api-report-testing_core.md @@ -1218,8 +1218,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report-utilities.md b/.api-reports/api-report-utilities.md index 410b9ded70b..f10def0a20a 100644 --- a/.api-reports/api-report-utilities.md +++ b/.api-reports/api-report-utilities.md @@ -1929,8 +1929,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.api-reports/api-report.md b/.api-reports/api-report.md index 54d5f97f022..f30c67954a9 100644 --- a/.api-reports/api-report.md +++ b/.api-reports/api-report.md @@ -2039,8 +2039,6 @@ class QueryInfo { // (undocumented) stopped: boolean; // (undocumented) - subscriptions: Set; - // (undocumented) variables?: Record; } diff --git a/.changeset/short-owls-breathe.md b/.changeset/short-owls-breathe.md new file mode 100644 index 00000000000..352eb2f6409 --- /dev/null +++ b/.changeset/short-owls-breathe.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Remove some dead code. diff --git a/src/core/QueryInfo.ts b/src/core/QueryInfo.ts index 4ddb60fce34..1b6f17acc5a 100644 --- a/src/core/QueryInfo.ts +++ b/src/core/QueryInfo.ts @@ -9,7 +9,6 @@ import type { ObservableQuery } from "./ObservableQuery.js"; import { reobserveCacheFirst } from "./ObservableQuery.js"; import type { QueryListener, MethodKeys } from "./types.js"; import type { FetchResult } from "../link/core/index.js"; -import type { ObservableSubscription } from "../utilities/index.js"; import { isNonEmptyArray, graphQLResultHasError, @@ -78,7 +77,6 @@ export class QueryInfo { listeners = new Set(); document: DocumentNode | null = null; lastRequestId = 1; - subscriptions = new Set(); variables?: Record; networkStatus?: NetworkStatus; networkError?: Error | null; @@ -293,8 +291,6 @@ export class QueryInfo { // QueryInfo.prototype. this.cancel = QueryInfo.prototype.cancel; - this.subscriptions.forEach((sub) => sub.unsubscribe()); - const oq = this.observableQuery; if (oq) oq.stopPolling(); }