Skip to content

Commit

Permalink
use external package to wrap React imports to circumvent non-existi…
Browse files Browse the repository at this point in the history
…ng functions in RSC (#11175)

Co-authored-by: Jerel Miller <[email protected]>
  • Loading branch information
phryneas and jerelmiller authored Nov 8, 2023
1 parent 776631d commit d6d1491
Show file tree
Hide file tree
Showing 42 changed files with 179 additions and 121 deletions.
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 @@ -219,14 +216,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 @@ -320,12 +317,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 @@ -857,7 +854,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 @@ -1420,7 +1417,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 @@ -1780,11 +1777,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
15 changes: 7 additions & 8 deletions .api-reports/api-report-react_components.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 @@ -16,6 +14,7 @@ import type { GraphQLErrorExtensions } from 'graphql';
import { Observable } from 'zen-observable-ts';
import type { Observer } from 'zen-observable-ts';
import * as PropTypes from 'prop-types';
import type * as ReactTypes from 'react';
import type { Subscriber } from 'zen-observable-ts';
import type { Subscription as Subscription_2 } from 'zen-observable-ts';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
Expand Down Expand Up @@ -915,7 +914,7 @@ type Modifiers<T extends Record<string, any> = Record<string, unknown>> = Partia
}>;

// @public (undocumented)
export function Mutation<TData = any, TVariables = OperationVariables>(props: MutationComponentOptions<TData, TVariables>): JSX.Element | null;
export function Mutation<TData = any, TVariables = OperationVariables>(props: MutationComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;

// @public (undocumented)
export namespace Mutation {
Expand Down Expand Up @@ -967,7 +966,7 @@ export interface MutationComponentOptions<TData = any, TVariables = OperationVar
// Warning: (ae-forgotten-export) The symbol "MutationResult" needs to be exported by the entry point index.d.ts
//
// (undocumented)
children: (mutateFunction: MutationFunction<TData, TVariables, TContext>, result: MutationResult<TData>) => JSX.Element | null;
children: (mutateFunction: MutationFunction<TData, TVariables, TContext>, result: MutationResult<TData>) => ReactTypes.JSX.Element | null;
// (undocumented)
mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
}
Expand Down Expand Up @@ -1205,7 +1204,7 @@ type OperationVariables = Record<string, any>;
type Path = ReadonlyArray<string | number>;

// @public (undocumented)
export function Query<TData = any, TVariables extends OperationVariables = OperationVariables>(props: QueryComponentOptions<TData, TVariables>): JSX.Element | null;
export function Query<TData = any, TVariables extends OperationVariables = OperationVariables>(props: QueryComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;

// @public (undocumented)
export namespace Query {
Expand All @@ -1226,7 +1225,7 @@ export interface QueryComponentOptions<TData = any, TVariables extends Operation
// Warning: (ae-forgotten-export) The symbol "QueryResult" needs to be exported by the entry point index.d.ts
//
// (undocumented)
children: (result: QueryResult<TData, TVariables>) => JSX.Element | null;
children: (result: QueryResult<TData, TVariables>) => ReactTypes.JSX.Element | null;
// (undocumented)
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
}
Expand Down Expand Up @@ -1615,7 +1614,7 @@ type SubscribeToMoreOptions<TData = any, TSubscriptionVariables = OperationVaria
};

// @public (undocumented)
export function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(props: SubscriptionComponentOptions<TData, TVariables>): JSX.Element | null;
export function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(props: SubscriptionComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;

// @public (undocumented)
export namespace Subscription {
Expand All @@ -1634,7 +1633,7 @@ export interface Subscription<TData, TVariables extends OperationVariables> {
// @public (undocumented)
export interface SubscriptionComponentOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends BaseSubscriptionOptions<TData, TVariables> {
// (undocumented)
children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);
children?: null | ((result: SubscriptionResult<TData>) => ReactTypes.JSX.Element | null);
// (undocumented)
subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;
}
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 @@ -217,14 +214,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 @@ -316,12 +313,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 @@ -723,7 +720,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 @@ -1136,7 +1133,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 @@ -1454,11 +1451,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
14 changes: 6 additions & 8 deletions .api-reports/api-report-react_hoc.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,7 +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 * 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 @@ -733,7 +731,7 @@ interface FragmentMap {
type FragmentMatcher = (rootValue: any, typeCondition: string, context: any) => boolean;

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

// @public (undocumented)
type GraphQLErrors = ReadonlyArray<GraphQLError>;
Expand Down Expand Up @@ -1660,21 +1658,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
Loading

0 comments on commit d6d1491

Please sign in to comment.