Skip to content

Commit

Permalink
Remove deprecated SuspenseCache export (#11229)
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas authored Sep 20, 2023
1 parent b69d348 commit c372bad
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 111 deletions.
25 changes: 0 additions & 25 deletions .api-reports/api-report-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,6 @@ export interface BackgroundQueryHookOptions<TData = unknown, TVariables extends
queryKey?: string | number | any[];
// (undocumented)
skip?: boolean;
// (undocumented)
suspenseCache?: SuspenseCache;
}

// @public (undocumented)
Expand Down Expand Up @@ -1917,27 +1915,6 @@ export interface SubscriptionResult<TData = any, TVariables = any> {
variables?: TVariables;
}

// Warning: (ae-forgotten-export) The symbol "SuspenseCache_2" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class SuspenseCache extends SuspenseCache_2 {
constructor();
}

// @public (undocumented)
class SuspenseCache_2 {
// Warning: (ae-forgotten-export) The symbol "SuspenseCacheOptions" needs to be exported by the entry point index.d.ts
constructor(options?: SuspenseCacheOptions);
// (undocumented)
getQueryRef<TData = any>(cacheKey: CacheKey, createObservable: () => ObservableQuery<TData>): InternalQueryReference<TData>;
}

// @public (undocumented)
interface SuspenseCacheOptions {
// (undocumented)
autoDisposeTimeoutMs?: number;
}

// @public (undocumented)
export type SuspenseQueryHookFetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;

Expand All @@ -1949,8 +1926,6 @@ export interface SuspenseQueryHookOptions<TData = unknown, TVariables extends Op
queryKey?: string | number | any[];
// (undocumented)
skip?: boolean;
// (undocumented)
suspenseCache?: SuspenseCache;
}

// @public (undocumented)
Expand Down
27 changes: 0 additions & 27 deletions .api-reports/api-report-react_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,6 @@ interface BackgroundQueryHookOptions<TData = unknown, TVariables extends Operati
queryKey?: string | number | any[];
// (undocumented)
skip?: boolean;
// Warning: (ae-forgotten-export) The symbol "SuspenseCache" needs to be exported by the entry point index.d.ts
//
// (undocumented)
suspenseCache?: SuspenseCache;
}

// Warning: (ae-forgotten-export) The symbol "BackgroundQueryHookOptions" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -1798,27 +1794,6 @@ interface SubscriptionResult<TData = any, TVariables = any> {
variables?: TVariables;
}

// Warning: (ae-forgotten-export) The symbol "SuspenseCache_2" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
class SuspenseCache extends SuspenseCache_2 {
constructor();
}

// @public (undocumented)
class SuspenseCache_2 {
// Warning: (ae-forgotten-export) The symbol "SuspenseCacheOptions" needs to be exported by the entry point index.d.ts
constructor(options?: SuspenseCacheOptions);
// (undocumented)
getQueryRef<TData = any>(cacheKey: CacheKey, createObservable: () => ObservableQuery<TData>): InternalQueryReference<TData>;
}

// @public (undocumented)
interface SuspenseCacheOptions {
// (undocumented)
autoDisposeTimeoutMs?: number;
}

// @public (undocumented)
type SuspenseQueryHookFetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;

Expand All @@ -1832,8 +1807,6 @@ interface SuspenseQueryHookOptions<TData = unknown, TVariables extends Operation
queryKey?: string | number | any[];
// (undocumented)
skip?: boolean;
// (undocumented)
suspenseCache?: SuspenseCache;
}

// @public (undocumented)
Expand Down
25 changes: 0 additions & 25 deletions .api-reports/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,6 @@ export interface BackgroundQueryHookOptions<TData = unknown, TVariables extends
queryKey?: string | number | any[];
// (undocumented)
skip?: boolean;
// (undocumented)
suspenseCache?: SuspenseCache;
}

// @public (undocumented)
Expand Down Expand Up @@ -2529,27 +2527,6 @@ export interface SubscriptionResult<TData = any, TVariables = any> {
variables?: TVariables;
}

// Warning: (ae-forgotten-export) The symbol "SuspenseCache_2" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class SuspenseCache extends SuspenseCache_2 {
constructor();
}

// @public (undocumented)
class SuspenseCache_2 {
// Warning: (ae-forgotten-export) The symbol "SuspenseCacheOptions" needs to be exported by the entry point index.d.ts
constructor(options?: SuspenseCacheOptions);
// (undocumented)
getQueryRef<TData = any>(cacheKey: CacheKey, createObservable: () => ObservableQuery<TData>): InternalQueryReference<TData>;
}

// @public (undocumented)
interface SuspenseCacheOptions {
// (undocumented)
autoDisposeTimeoutMs?: number;
}

// @public (undocumented)
export type SuspenseQueryHookFetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;

Expand All @@ -2561,8 +2538,6 @@ export interface SuspenseQueryHookOptions<TData = unknown, TVariables extends Op
queryKey?: string | number | any[];
// (undocumented)
skip?: boolean;
// (undocumented)
suspenseCache?: SuspenseCache;
}

// @public (undocumented)
Expand Down
5 changes: 5 additions & 0 deletions .changeset/pretty-readers-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Remove (already throwing) SuspenseCache export that should have been removed in 3.8.
4 changes: 2 additions & 2 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const checks = [
{
path: "dist/apollo-client.min.cjs",
limit: "38190",
limit: "37986",
},
{
path: "dist/main.cjs",
Expand All @@ -10,7 +10,7 @@ const checks = [
{
path: "dist/index.js",
import: "{ ApolloClient, InMemoryCache, HttpLink }",
limit: "32044",
limit: "32019",
},
...[
"ApolloProvider",
Expand Down
2 changes: 0 additions & 2 deletions src/__tests__/__snapshots__/exports.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Array [
"NetworkStatus",
"Observable",
"ObservableQuery",
"SuspenseCache",
"checkFetcher",
"concat",
"createHttpLink",
Expand Down Expand Up @@ -265,7 +264,6 @@ Array [
"ApolloConsumer",
"ApolloProvider",
"DocumentType",
"SuspenseCache",
"getApolloContext",
"operationName",
"parser",
Expand Down
25 changes: 0 additions & 25 deletions src/react/cache/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,2 @@
export type { SuspenseCacheOptions } from "./SuspenseCache.js";
export { getSuspenseCache } from "./getSuspenseCache.js";

import { SuspenseCache as RealSuspenseCache } from "./SuspenseCache.js";

// TODO: remove export with release 3.8
// replace with
// export type { SuspenseCache } from './SuspenseCache.js';
/**
* @deprecated
* It is no longer necessary to create a `SuspenseCache` instance and pass it into the `ApolloProvider`.
* Please remove this code from your application.
*
* This export will be removed with the final 3.8 release.
*/
export class SuspenseCache extends RealSuspenseCache {
constructor() {
super();
// throwing an error here instead of using invariant - we do not want this error
// message to be link-ified, but to directly show up as bold as possible
throw new Error(
"It is no longer necessary to create a `SuspenseCache` instance and pass it into the `ApolloProvider`.\n" +
"Please remove this code from your application. \n\n" +
"This export will be removed with the final 3.8 release."
);
}
}
2 changes: 0 additions & 2 deletions src/react/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export {
} from "./context/index.js";

export * from "./hooks/index.js";
// TODO: remove export with release 3.8
export { SuspenseCache } from "./cache/index.js";

export type { IDocumentDefinition } from "./parser/index.js";
export { DocumentType, operationName, parser } from "./parser/index.js";
Expand Down
3 changes: 0 additions & 3 deletions src/react/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import type {
WatchQueryOptions,
WatchQueryFetchPolicy,
} from "../../core/index.js";
import type { SuspenseCache } from "../cache/index.js";

/* QueryReference type */

Expand Down Expand Up @@ -134,7 +133,6 @@ export interface SuspenseQueryHookOptions<
| "refetchWritePolicy"
> {
fetchPolicy?: SuspenseQueryHookFetchPolicy;
suspenseCache?: SuspenseCache;
queryKey?: string | number | any[];

/**
Expand Down Expand Up @@ -172,7 +170,6 @@ export interface BackgroundQueryHookOptions<
| "refetchWritePolicy"
> {
fetchPolicy?: BackgroundQueryHookFetchPolicy;
suspenseCache?: SuspenseCache;
queryKey?: string | number | any[];

/**
Expand Down

0 comments on commit c372bad

Please sign in to comment.