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

use external package to wrap React imports to circumvent non-existing functions in RSC #11175

Merged
merged 12 commits into from
Nov 8, 2023
21 changes: 9 additions & 12 deletions .api-reports/api-report-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

```ts

/// <reference types="react" />

import type { ASTNode } from 'graphql';
import type { DocumentNode } from 'graphql';
import type { ExecutionResult } from 'graphql';
Expand All @@ -15,8 +13,7 @@ import type { GraphQLError } from 'graphql';
import type { GraphQLErrorExtensions } from 'graphql';
import { Observable } from 'zen-observable-ts';
import type { Observer } from 'zen-observable-ts';
import * as React_2 from 'react';
import { ReactNode } from 'react';
import type * as ReactTypes from 'react';
import type { Subscriber } from 'zen-observable-ts';
import type { Subscription } from 'zen-observable-ts';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
Expand Down Expand Up @@ -216,14 +213,14 @@ type ApolloClientOptions<TCacheShape> = {
// Warning: (ae-forgotten-export) The symbol "ApolloConsumerProps" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const ApolloConsumer: React_2.FC<ApolloConsumerProps>;
export const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps>;

// @public (undocumented)
interface ApolloConsumerProps {
// Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts
//
// (undocumented)
children: (client: ApolloClient<object>) => React_2.ReactChild | null;
children: (client: ApolloClient<object>) => ReactTypes.ReactChild | null;
}

// @public (undocumented)
Expand Down Expand Up @@ -317,12 +314,12 @@ class ApolloLink {
// Warning: (ae-forgotten-export) The symbol "ApolloProviderProps" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const ApolloProvider: React_2.FC<ApolloProviderProps<any>>;
export const ApolloProvider: ReactTypes.FC<ApolloProviderProps<any>>;

// @public (undocumented)
interface ApolloProviderProps<TCache> {
// (undocumented)
children: React_2.ReactNode | React_2.ReactNode[] | null;
children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null;
// (undocumented)
client: ApolloClient<TCache>;
}
Expand Down Expand Up @@ -847,7 +844,7 @@ interface FragmentMap {
type FragmentMatcher = (rootValue: any, typeCondition: string, context: any) => boolean;

// @public (undocumented)
export function getApolloContext(): React_2.Context<ApolloContextValue>;
export function getApolloContext(): ReactTypes.Context<ApolloContextValue>;

// @public (undocumented)
type GraphQLErrors = ReadonlyArray<GraphQLError>;
Expand Down Expand Up @@ -1410,7 +1407,7 @@ interface QueryData {
// @public (undocumented)
export interface QueryDataOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends QueryFunctionOptions<TData, TVariables> {
// (undocumented)
children?: (result: QueryResult<TData, TVariables>) => ReactNode;
children?: (result: QueryResult<TData, TVariables>) => ReactTypes.ReactNode;
// (undocumented)
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
}
Expand Down Expand Up @@ -1767,11 +1764,11 @@ type RefetchWritePolicy = "merge" | "overwrite";
// @public (undocumented)
class RenderPromises {
// (undocumented)
addObservableQueryPromise<TData, TVariables extends OperationVariables>(obsQuery: ObservableQuery<TData, TVariables>): ReactNode;
addObservableQueryPromise<TData, TVariables extends OperationVariables>(obsQuery: ObservableQuery<TData, TVariables>): ReactTypes.ReactNode;
// Warning: (ae-forgotten-export) The symbol "QueryData" needs to be exported by the entry point index.d.ts
//
// (undocumented)
addQueryPromise(queryInstance: QueryData, finish?: () => React.ReactNode): React.ReactNode;
addQueryPromise(queryInstance: QueryData, finish?: () => ReactTypes.ReactNode): ReactTypes.ReactNode;
// (undocumented)
consumeAndAwaitPromises(): Promise<any[]>;
// (undocumented)
Expand Down
21 changes: 9 additions & 12 deletions .api-reports/api-report-react_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

```ts

/// <reference types="react" />

import type { ASTNode } from 'graphql';
import type { DocumentNode } from 'graphql';
import type { ExecutionResult } from 'graphql';
Expand All @@ -15,8 +13,7 @@ import type { GraphQLError } from 'graphql';
import type { GraphQLErrorExtensions } from 'graphql';
import { Observable } from 'zen-observable-ts';
import type { Observer } from 'zen-observable-ts';
import * as React_2 from 'react';
import { ReactNode } from 'react';
import type * as ReactTypes from 'react';
import type { Subscriber } from 'zen-observable-ts';
import type { Subscription } from 'zen-observable-ts';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
Expand Down Expand Up @@ -214,14 +211,14 @@ type ApolloClientOptions<TCacheShape> = {
};

// @public (undocumented)
export const ApolloConsumer: React_2.FC<ApolloConsumerProps>;
export const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps>;

// @public (undocumented)
export interface ApolloConsumerProps {
// Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts
//
// (undocumented)
children: (client: ApolloClient<object>) => React_2.ReactChild | null;
children: (client: ApolloClient<object>) => ReactTypes.ReactChild | null;
}

// @public (undocumented)
Expand Down Expand Up @@ -313,12 +310,12 @@ class ApolloLink {
}

// @public (undocumented)
export const ApolloProvider: React_2.FC<ApolloProviderProps<any>>;
export const ApolloProvider: ReactTypes.FC<ApolloProviderProps<any>>;

// @public (undocumented)
export interface ApolloProviderProps<TCache> {
// (undocumented)
children: React_2.ReactNode | React_2.ReactNode[] | null;
children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null;
// (undocumented)
client: ApolloClient<TCache>;
}
Expand Down Expand Up @@ -713,7 +710,7 @@ interface FragmentMap {
type FragmentMatcher = (rootValue: any, typeCondition: string, context: any) => boolean;

// @public (undocumented)
export function getApolloContext(): React_2.Context<ApolloContextValue>;
export function getApolloContext(): ReactTypes.Context<ApolloContextValue>;

// @public (undocumented)
type GraphQLErrors = ReadonlyArray<GraphQLError>;
Expand Down Expand Up @@ -1126,7 +1123,7 @@ interface QueryDataOptions<TData = any, TVariables extends OperationVariables =
// Warning: (ae-forgotten-export) The symbol "QueryResult" needs to be exported by the entry point index.d.ts
//
// (undocumented)
children?: (result: QueryResult<TData, TVariables>) => ReactNode;
children?: (result: QueryResult<TData, TVariables>) => ReactTypes.ReactNode;
// (undocumented)
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
}
Expand Down Expand Up @@ -1441,11 +1438,11 @@ type RefetchWritePolicy = "merge" | "overwrite";
// @public (undocumented)
class RenderPromises {
// (undocumented)
addObservableQueryPromise<TData, TVariables extends OperationVariables>(obsQuery: ObservableQuery<TData, TVariables>): ReactNode;
addObservableQueryPromise<TData, TVariables extends OperationVariables>(obsQuery: ObservableQuery<TData, TVariables>): ReactTypes.ReactNode;
// Warning: (ae-forgotten-export) The symbol "QueryData" needs to be exported by the entry point index.d.ts
//
// (undocumented)
addQueryPromise(queryInstance: QueryData, finish?: () => React.ReactNode): React.ReactNode;
addQueryPromise(queryInstance: QueryData, finish?: () => ReactTypes.ReactNode): ReactTypes.ReactNode;
// (undocumented)
consumeAndAwaitPromises(): Promise<any[]>;
// Warning: (ae-forgotten-export) The symbol "QueryDataOptions" needs to be exported by the entry point index.d.ts
Expand Down
10 changes: 5 additions & 5 deletions .api-reports/api-report-react_hoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { GraphQLError } from 'graphql';
import type { GraphQLErrorExtensions } from 'graphql';
import { Observable } from 'zen-observable-ts';
import type { Observer } from 'zen-observable-ts';
import * as React_2 from 'react';
import type * as ReactTypes from 'react';
import type { Subscriber } from 'zen-observable-ts';
import type { Subscription } from 'zen-observable-ts';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
Expand Down Expand Up @@ -1645,21 +1645,21 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
}

// @public (undocumented)
export function withApollo<TProps, TResult = any>(WrappedComponent: React_2.ComponentType<WithApolloClient<Omit<TProps, "client">>>, operationOptions?: OperationOption<TProps, TResult>): React_2.ComponentClass<Omit<TProps, "client">>;
export function withApollo<TProps, TResult = any>(WrappedComponent: ReactTypes.ComponentType<WithApolloClient<Omit<TProps, "client">>>, operationOptions?: OperationOption<TProps, TResult>): ReactTypes.ComponentClass<Omit<TProps, "client">>;

// @public (undocumented)
export type WithApolloClient<P> = P & {
client?: ApolloClient<any>;
};

// @public (undocumented)
export function withMutation<TProps extends TGraphQLVariables | {} = {}, TData extends Record<string, any> = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps = MutateProps<TData, TGraphQLVariables>, TContext extends Record<string, any> = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: React_2.ComponentType<TProps & TChildProps>) => React_2.ComponentClass<TProps>;
export function withMutation<TProps extends TGraphQLVariables | {} = {}, TData extends Record<string, any> = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps = MutateProps<TData, TGraphQLVariables>, TContext extends Record<string, any> = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;

// @public (undocumented)
export function withQuery<TProps extends TGraphQLVariables | Record<string, any> = Record<string, any>, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: React_2.ComponentType<TProps & TChildProps>) => React_2.ComponentClass<TProps>;
export function withQuery<TProps extends TGraphQLVariables | Record<string, any> = Record<string, any>, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;

// @public (undocumented)
export function withSubscription<TProps extends TGraphQLVariables | {} = {}, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: React_2.ComponentType<TProps & TChildProps>) => React_2.ComponentClass<TProps>;
export function withSubscription<TProps extends TGraphQLVariables | {} = {}, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;

// Warnings were encountered during analysis:
//
Expand Down
20 changes: 8 additions & 12 deletions .api-reports/api-report-react_ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

```ts

/// <reference types="react" />

import type { ASTNode } from 'graphql';
import type { DocumentNode } from 'graphql';
import type { ExecutionResult } from 'graphql';
Expand All @@ -15,9 +13,7 @@ import type { GraphQLError } from 'graphql';
import type { GraphQLErrorExtensions } from 'graphql';
import { Observable } from 'zen-observable-ts';
import type { Observer } from 'zen-observable-ts';
import * as React_2 from 'react';
import type { ReactElement } from 'react';
import { ReactNode } from 'react';
import type * as ReactTypes from 'react';
import type { Subscriber } from 'zen-observable-ts';
import type { Subscription } from 'zen-observable-ts';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
Expand Down Expand Up @@ -684,7 +680,7 @@ interface FragmentMap {
type FragmentMatcher = (rootValue: any, typeCondition: string, context: any) => boolean;

// @public (undocumented)
export function getDataFromTree(tree: React_2.ReactNode, context?: {
export function getDataFromTree(tree: ReactTypes.ReactNode, context?: {
[key: string]: any;
}): Promise<string>;

Expand All @@ -695,11 +691,11 @@ export function getMarkupFromTree({ tree, context, renderFunction, }: GetMarkupF

// @public (undocumented)
type GetMarkupFromTreeOptions = {
tree: React_2.ReactNode;
tree: ReactTypes.ReactNode;
context?: {
[key: string]: any;
};
renderFunction?: (tree: React_2.ReactElement<any>) => string | PromiseLike<string>;
renderFunction?: (tree: ReactTypes.ReactElement<any>) => string | PromiseLike<string>;
};

// @public (undocumented)
Expand Down Expand Up @@ -1113,7 +1109,7 @@ interface QueryDataOptions<TData = any, TVariables extends OperationVariables =
// Warning: (ae-forgotten-export) The symbol "QueryResult" needs to be exported by the entry point index.d.ts
//
// (undocumented)
children?: (result: QueryResult<TData, TVariables>) => ReactNode;
children?: (result: QueryResult<TData, TVariables>) => ReactTypes.ReactNode;
// (undocumented)
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
}
Expand Down Expand Up @@ -1428,11 +1424,11 @@ type RefetchWritePolicy = "merge" | "overwrite";
// @public (undocumented)
export class RenderPromises {
// (undocumented)
addObservableQueryPromise<TData, TVariables extends OperationVariables>(obsQuery: ObservableQuery<TData, TVariables>): ReactNode;
addObservableQueryPromise<TData, TVariables extends OperationVariables>(obsQuery: ObservableQuery<TData, TVariables>): ReactTypes.ReactNode;
// Warning: (ae-forgotten-export) The symbol "QueryData" needs to be exported by the entry point index.d.ts
//
// (undocumented)
addQueryPromise(queryInstance: QueryData, finish?: () => React.ReactNode): React.ReactNode;
addQueryPromise(queryInstance: QueryData, finish?: () => ReactTypes.ReactNode): ReactTypes.ReactNode;
// (undocumented)
consumeAndAwaitPromises(): Promise<any[]>;
// Warning: (ae-forgotten-export) The symbol "QueryDataOptions" needs to be exported by the entry point index.d.ts
Expand All @@ -1448,7 +1444,7 @@ export class RenderPromises {
}

// @public (undocumented)
export function renderToStringWithData(component: ReactElement<any>): Promise<string>;
export function renderToStringWithData(component: ReactTypes.ReactElement<any>): Promise<string>;

// @public (undocumented)
type RequestHandler = (operation: Operation, forward: NextLink) => Observable<FetchResult> | null;
Expand Down
21 changes: 9 additions & 12 deletions .api-reports/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

```ts

/// <reference types="react" />

import type { ASTNode } from 'graphql';
import { disableExperimentalFragmentVariables } from 'graphql-tag';
import { disableFragmentWarnings } from 'graphql-tag';
Expand All @@ -23,8 +21,7 @@ import { Observable } from 'zen-observable-ts';
import type { Subscription as ObservableSubscription } from 'zen-observable-ts';
import type { Observer } from 'zen-observable-ts';
import { print as print_3 } from 'graphql';
import * as React_2 from 'react';
import { ReactNode } from 'react';
import type * as ReactTypes from 'react';
import { resetCaches } from 'graphql-tag';
import type { SelectionSetNode } from 'graphql';
import { setVerbosity as setLogVerbosity } from 'ts-invariant';
Expand Down Expand Up @@ -186,12 +183,12 @@ export type ApolloClientOptions<TCacheShape> = {
// Warning: (ae-forgotten-export) The symbol "ApolloConsumerProps" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const ApolloConsumer: React_2.FC<ApolloConsumerProps>;
export const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps>;

// @public (undocumented)
interface ApolloConsumerProps {
// (undocumented)
children: (client: ApolloClient<object>) => React_2.ReactChild | null;
children: (client: ApolloClient<object>) => ReactTypes.ReactChild | null;
}

// @public (undocumented)
Expand Down Expand Up @@ -284,12 +281,12 @@ export interface ApolloPayloadResult<TData = Record<string, any>, TExtensions =
// Warning: (ae-forgotten-export) The symbol "ApolloProviderProps" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const ApolloProvider: React_2.FC<ApolloProviderProps<any>>;
export const ApolloProvider: ReactTypes.FC<ApolloProviderProps<any>>;

// @public (undocumented)
interface ApolloProviderProps<TCache> {
// (undocumented)
children: React_2.ReactNode | React_2.ReactNode[] | null;
children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null;
// (undocumented)
client: ApolloClient<TCache>;
}
Expand Down Expand Up @@ -1062,7 +1059,7 @@ export function fromError<T>(errorValue: any): Observable<T>;
export function fromPromise<T>(promise: Promise<T>): Observable<T>;

// @public (undocumented)
export function getApolloContext(): React_2.Context<ApolloContextValue>;
export function getApolloContext(): ReactTypes.Context<ApolloContextValue>;

export { gql }

Expand Down Expand Up @@ -1966,7 +1963,7 @@ interface QueryData {
// @public (undocumented)
export interface QueryDataOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends QueryFunctionOptions<TData, TVariables> {
// (undocumented)
children?: (result: QueryResult<TData, TVariables>) => ReactNode;
children?: (result: QueryResult<TData, TVariables>) => ReactTypes.ReactNode;
// (undocumented)
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
}
Expand Down Expand Up @@ -2332,11 +2329,11 @@ type RefetchWritePolicy = "merge" | "overwrite";
// @public (undocumented)
class RenderPromises {
// (undocumented)
addObservableQueryPromise<TData, TVariables extends OperationVariables>(obsQuery: ObservableQuery<TData, TVariables>): ReactNode;
addObservableQueryPromise<TData, TVariables extends OperationVariables>(obsQuery: ObservableQuery<TData, TVariables>): ReactTypes.ReactNode;
// Warning: (ae-forgotten-export) The symbol "QueryData" needs to be exported by the entry point index.d.ts
//
// (undocumented)
addQueryPromise(queryInstance: QueryData, finish?: () => React.ReactNode): React.ReactNode;
addQueryPromise(queryInstance: QueryData, finish?: () => ReactTypes.ReactNode): ReactTypes.ReactNode;
// (undocumented)
consumeAndAwaitPromises(): Promise<any[]>;
// (undocumented)
Expand Down
5 changes: 5 additions & 0 deletions .changeset/friendly-clouds-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": minor
---

use external package to wrap `React` imports to circumvent non-existing functions in RSC
2 changes: 1 addition & 1 deletion .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: "37960",
limit: "37981",
},
{
path: "dist/main.cjs",
Expand Down
Loading