Skip to content

Commit 2a67ffc

Browse files
move hook documentation (and others) into code, improve documentation components (#11381)
* move some docs to comments * remove comments * fix missing space * add api_doc * tweak in file generation * build from docs branch * switch docs branch back to `main` * bump CI * Enum & PropertyDetails * WIP - see current state of `hooks.mdx` * completely remove `query-options` and `query-result` mdx * useMutation * handle subscription docs * better function signature * more hooks * fix up import * chores * formatting * suppress tsdoc warning * api explorer nitpicks * support for @deprecated * use prerendered markdown in comments to prevent client-side parsing * add propTypes * apply prettier * fixup * also display interface details for slightly complex types * heading styling, do not use h6 * since everywhere, styling, `link` defaults * add grouping, create documentation interface * `MutationOptionsDocumentation` interface * api reports * subscription options * api repots * prettier * fix some references * cleanup * fix up SubHeading links * don't add prefix to parameter properties * allow property deep linking * prettier * more cleanup * also add result documentation * more doccomment work * fixup * add missing import * fixup * remove `result` property (it's not a function) * Revert "remove `result` property (it's not a function)" This reverts commit 57c8526. * functions adjustments only show parameters section if there are parameters only show results if result is not `void` or user-specified * move heading out of example children * Update docs/shared/ApiDoc/EnumDetails.js Co-authored-by: Jerel Miller <[email protected]> * remove obsolete props * address top padding for "smaller" headings * review feedback * fixup codeblock * move `SourceLink` out of `Heading` * throw an error if both `as` and `headingLevel` are specified in `Heading` * move jsx * always link headings * move headings out of table components * review comment * Update docs/shared/ApiDoc/Tuple.js Co-authored-by: Jerel Miller <[email protected]> * nit :) * more updates * fix link --------- Co-authored-by: Jerel Miller <[email protected]>
1 parent 25b83da commit 2a67ffc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2830
-3266
lines changed

.api-reports/api-report-cache.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export namespace DataProxy {
234234
}
235235
// (undocumented)
236236
export interface ReadFragmentOptions<TData, TVariables> extends Fragment<TVariables, TData> {
237-
// @deprecated (undocumented)
237+
// @deprecated
238238
canonizeResults?: boolean;
239239
optimistic?: boolean;
240240
returnPartialData?: boolean;

.api-reports/api-report-core.md

+48-40
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,18 @@ export interface ApolloPayloadResult<TData = Record<string, any>, TExtensions =
253253
}
254254

255255
// @public (undocumented)
256-
export type ApolloQueryResult<T> = {
256+
export interface ApolloQueryResult<T> {
257+
// (undocumented)
257258
data: T;
258-
errors?: ReadonlyArray<GraphQLError>;
259259
error?: ApolloError;
260+
errors?: ReadonlyArray<GraphQLError>;
261+
// (undocumented)
260262
loading: boolean;
263+
// (undocumented)
261264
networkStatus: NetworkStatus;
265+
// (undocumented)
262266
partial?: boolean;
263-
};
267+
}
264268

265269
// @public (undocumented)
266270
export type ApolloReducerConfig = {
@@ -479,7 +483,7 @@ export namespace DataProxy {
479483
}
480484
// (undocumented)
481485
export interface ReadFragmentOptions<TData, TVariables> extends Fragment<TVariables, TData> {
482-
// @deprecated (undocumented)
486+
// @deprecated
483487
canonizeResults?: boolean;
484488
optimistic?: boolean;
485489
returnPartialData?: boolean;
@@ -591,9 +595,7 @@ export type DocumentTransformCacheKey = ReadonlyArray<unknown>;
591595

592596
// @public (undocumented)
593597
interface DocumentTransformOptions {
594-
// (undocumented)
595598
cache?: boolean;
596-
// (undocumented)
597599
getCacheKey?: (document: DocumentNode) => DocumentTransformCacheKey | undefined;
598600
}
599601

@@ -766,9 +768,7 @@ export interface FetchMoreOptions<TData = any, TVariables = OperationVariables>
766768
export interface FetchMoreQueryOptions<TVariables, TData = any> {
767769
// (undocumented)
768770
context?: DefaultContext;
769-
// (undocumented)
770771
query?: DocumentNode | TypedDocumentNode<TData, TVariables>;
771-
// (undocumented)
772772
variables?: Partial<TVariables>;
773773
}
774774

@@ -1359,12 +1359,10 @@ interface MutationBaseOptions<TData = any, TVariables = OperationVariables, TCon
13591359
// @public (undocumented)
13601360
export type MutationFetchPolicy = Extract<FetchPolicy, "network-only" | "no-cache">;
13611361

1362-
// Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts
1362+
// Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts
13631363
//
13641364
// @public (undocumented)
1365-
export interface MutationOptions<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {
1366-
fetchPolicy?: MutationFetchPolicy;
1367-
keepRootFields?: boolean;
1365+
export interface MutationOptions<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> extends MutationSharedOptions<TData, TVariables, TContext, TCache> {
13681366
mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
13691367
}
13701368

@@ -1382,6 +1380,14 @@ export type MutationQueryReducersMap<T = {
13821380
[queryName: string]: MutationQueryReducer<T>;
13831381
};
13841382

1383+
// Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts
1384+
//
1385+
// @public (undocumented)
1386+
interface MutationSharedOptions<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {
1387+
fetchPolicy?: MutationFetchPolicy;
1388+
keepRootFields?: boolean;
1389+
}
1390+
13851391
// @public (undocumented)
13861392
interface MutationStoreValue {
13871393
// (undocumented)
@@ -1394,7 +1400,7 @@ interface MutationStoreValue {
13941400
variables: Record<string, any>;
13951401
}
13961402

1397-
// @public (undocumented)
1403+
// @public @deprecated (undocumented)
13981404
export type MutationUpdaterFn<T = {
13991405
[key: string]: any;
14001406
}> = (cache: ApolloCache<T>, mutationResult: FetchResult<T>) => void;
@@ -1486,7 +1492,6 @@ export class ObservableQuery<TData = any, TVariables extends OperationVariables
14861492
queryInfo: QueryInfo;
14871493
options: WatchQueryOptions<TVariables, TData>;
14881494
});
1489-
// (undocumented)
14901495
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
14911496
updateQuery?: (previousQueryResult: TData, options: {
14921497
fetchMoreResult: TFetchData;
@@ -1535,15 +1540,10 @@ export class ObservableQuery<TData = any, TVariables extends OperationVariables
15351540
setVariables(variables: TVariables): Promise<ApolloQueryResult<TData> | void>;
15361541
// (undocumented)
15371542
silentSetOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): void;
1538-
// (undocumented)
15391543
startPolling(pollInterval: number): void;
1540-
// (undocumented)
15411544
stopPolling(): void;
1542-
// (undocumented)
15431545
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
1544-
// (undocumented)
15451546
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData): void;
1546-
// (undocumented)
15471547
get variables(): TVariables | undefined;
15481548
}
15491549

@@ -1830,12 +1830,13 @@ class QueryManager<TStore> {
18301830

18311831
// @public
18321832
interface QueryOptions<TVariables = OperationVariables, TData = any> {
1833-
// @deprecated (undocumented)
1833+
// @deprecated
18341834
canonizeResults?: boolean;
18351835
context?: DefaultContext;
18361836
errorPolicy?: ErrorPolicy;
18371837
fetchPolicy?: FetchPolicy;
18381838
notifyOnNetworkStatusChange?: boolean;
1839+
// @deprecated
18391840
partialRefetch?: boolean;
18401841
pollInterval?: number;
18411842
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
@@ -2012,6 +2013,26 @@ export type ServerParseError = Error & {
20122013

20132014
export { setLogVerbosity }
20142015

2016+
// @public (undocumented)
2017+
interface SharedWatchQueryOptions<TVariables extends OperationVariables, TData> {
2018+
// @deprecated
2019+
canonizeResults?: boolean;
2020+
context?: DefaultContext;
2021+
errorPolicy?: ErrorPolicy;
2022+
fetchPolicy?: WatchQueryFetchPolicy;
2023+
initialFetchPolicy?: WatchQueryFetchPolicy;
2024+
// Warning: (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
2025+
nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
2026+
notifyOnNetworkStatusChange?: boolean;
2027+
// @deprecated
2028+
partialRefetch?: boolean;
2029+
pollInterval?: number;
2030+
refetchWritePolicy?: RefetchWritePolicy;
2031+
returnPartialData?: boolean;
2032+
skipPollAttempt?: () => boolean;
2033+
variables?: TVariables;
2034+
}
2035+
20152036
// @public (undocumented)
20162037
export interface SingleExecutionResult<TData = Record<string, any>, TContext = DefaultContext, TExtensions = Record<string, any>> extends ExecutionResult<TData, TExtensions> {
20172038
// (undocumented)
@@ -2156,24 +2177,11 @@ export interface UriFunction {
21562177
// @public (undocumented)
21572178
export type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network";
21582179

2180+
// Warning: (ae-forgotten-export) The symbol "SharedWatchQueryOptions" needs to be exported by the entry point index.d.ts
2181+
//
21592182
// @public
2160-
export interface WatchQueryOptions<TVariables extends OperationVariables = OperationVariables, TData = any> {
2161-
// @deprecated (undocumented)
2162-
canonizeResults?: boolean;
2163-
context?: DefaultContext;
2164-
errorPolicy?: ErrorPolicy;
2165-
fetchPolicy?: WatchQueryFetchPolicy;
2166-
initialFetchPolicy?: WatchQueryFetchPolicy;
2167-
// Warning: (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
2168-
nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
2169-
notifyOnNetworkStatusChange?: boolean;
2170-
partialRefetch?: boolean;
2171-
pollInterval?: number;
2183+
export interface WatchQueryOptions<TVariables extends OperationVariables = OperationVariables, TData = any> extends SharedWatchQueryOptions<TVariables, TData> {
21722184
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
2173-
refetchWritePolicy?: RefetchWritePolicy;
2174-
returnPartialData?: boolean;
2175-
skipPollAttempt?: () => boolean;
2176-
variables?: TVariables;
21772185
}
21782186

21792187
// @public (undocumented)
@@ -2214,13 +2222,13 @@ interface WriteContext extends ReadMergeModifyContext {
22142222
// src/cache/inmemory/policies.ts:161:3 - (ae-forgotten-export) The symbol "KeySpecifier" needs to be exported by the entry point index.d.ts
22152223
// src/cache/inmemory/policies.ts:161:3 - (ae-forgotten-export) The symbol "KeyArgsFunction" needs to be exported by the entry point index.d.ts
22162224
// src/cache/inmemory/types.ts:139:3 - (ae-forgotten-export) The symbol "KeyFieldsFunction" needs to be exported by the entry point index.d.ts
2217-
// src/core/ObservableQuery.ts:113:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
2218-
// src/core/ObservableQuery.ts:114:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
2225+
// src/core/ObservableQuery.ts:116:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
2226+
// src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
22192227
// src/core/QueryManager.ts:124:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
22202228
// src/core/QueryManager.ts:158:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
22212229
// src/core/QueryManager.ts:399:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
2222-
// src/core/watchQueryOptions.ts:277:3 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
2223-
// src/core/watchQueryOptions.ts:316:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
2230+
// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
2231+
// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
22242232
// src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts
22252233

22262234
// (No @packageDocumentation comment for this package)

0 commit comments

Comments
 (0)