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

Add a new useLoadableQuery hook #11300

Merged
merged 201 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 191 commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
c735af0
Get bones of useInteractiveQuery in place
jerelmiller Aug 25, 2023
3034600
Disable useInteractiveQuery tests with React 17
jerelmiller Sep 5, 2023
bf591e0
Use separate type imports for useInteractiveQuery
jerelmiller Sep 5, 2023
2a9a14f
Get first test passing with profiler
jerelmiller Oct 16, 2023
8d354e4
Export RefetchWritePolicy type from core/index
jerelmiller Oct 16, 2023
7e50bf8
Simplify InteractiveQueryOptions type by flattening the type and only…
jerelmiller Oct 16, 2023
48c4a2f
Add comment to loadQuery and add label to variadic arg
jerelmiller Oct 16, 2023
d1fbedf
Add proper type tests for useInteractiveQuery
jerelmiller Oct 16, 2023
88ba71e
Pull tests out to top-level
jerelmiller Oct 16, 2023
bfedb96
Add tests for overriding client and adding context
jerelmiller Oct 16, 2023
3d30f2a
Add test for canonicalResults option for useInteractiveQuery
jerelmiller Oct 16, 2023
9c64cd1
Add test for disabling canonical results
jerelmiller Oct 16, 2023
0ad05df
Use more robust type for `result` in snapshots
jerelmiller Oct 16, 2023
8ad8c55
Add cache test
jerelmiller Oct 17, 2023
1808468
Add test to check partial data
jerelmiller Oct 17, 2023
deb928e
Use await on toRerender assertion
jerelmiller Oct 17, 2023
e7d9446
Add tests to check network-only and no-cache fetch policies
jerelmiller Oct 17, 2023
17563d2
Remove outer describe for integration with useReadQuery
jerelmiller Oct 17, 2023
c001bfd
Remove duplicate test
jerelmiller Oct 17, 2023
948015b
Get test with startTransition and changing variables working
jerelmiller Oct 17, 2023
6565429
Add test and missing implementation for changing error policies
jerelmiller Oct 17, 2023
d9a3d12
Update test that checks changes to context between renders
jerelmiller Oct 17, 2023
9514103
Move suspense boundary in test to better reflect recommended usage
jerelmiller Oct 19, 2023
e3cb1e3
Temp skip all failing tests to update one-by-one
jerelmiller Oct 25, 2023
c6bd655
Get test for cache-and-network updated to work correctly
jerelmiller Nov 8, 2023
8f145a1
Update test to ensure deferred queries with cache-and-network behave …
jerelmiller Nov 8, 2023
29fd6cd
Update test that checks cache updates
jerelmiller Nov 8, 2023
4cf688d
Remove unused renderIntegrationTest helper in useInteractiveQuery tests
jerelmiller Nov 8, 2023
ed39fa1
Rename helper to useVariablesQueryCase to better match convention
jerelmiller Nov 8, 2023
67092e2
Add test to validate variables can be used with loadQuery
jerelmiller Nov 8, 2023
a1caec2
Add test to check that variables can be changed by calling loadQuery …
jerelmiller Nov 8, 2023
c769437
Update test that checks that error policy is applied between renders
jerelmiller Nov 8, 2023
e0a1f89
More robust variables argument definition when using optional variables
jerelmiller Nov 8, 2023
98dc882
Remove mock overrides in case helpers and fix MockedResponse types
jerelmiller Nov 8, 2023
46d894c
Update result canonization test to use useInteractiveQuery
jerelmiller Nov 8, 2023
11ac877
Enable context test
jerelmiller Nov 8, 2023
39b8a0b
Enable test that checks refetchWritePolicy changes
jerelmiller Nov 8, 2023
dc6daa7
Enable test that checks returnPartialData changing
jerelmiller Nov 8, 2023
287e599
Enable test that checks changes to fetchPolicy
jerelmiller Nov 8, 2023
66ada14
Flatten refetch and fetchMore tests
jerelmiller Nov 8, 2023
f14a33d
Add custom matchers to check if profiled component has rendered or ha…
jerelmiller Nov 8, 2023
7785ab5
Use a nicer matcher hint on toRerender
jerelmiller Nov 9, 2023
66d03a6
Move failure message for toRerender below matcher hint
jerelmiller Nov 9, 2023
1c70110
Use waitForNextRender in toRerender to avoid needing to advance the i…
jerelmiller Nov 9, 2023
0a8b235
Use simpler style for profiling components in test
jerelmiller Nov 9, 2023
6604504
Create helpers to render with mocks or with client
jerelmiller Nov 9, 2023
3e8d154
Use render helpers in all passing tests
jerelmiller Nov 9, 2023
f123982
Reduce redundancy and increase consistency in naming of app component…
jerelmiller Nov 9, 2023
e3de8ee
Update variables test to use profile each component
jerelmiller Nov 9, 2023
221b498
Simplify changing variables test
jerelmiller Nov 9, 2023
a05594a
Simplify read query snapshot
jerelmiller Nov 9, 2023
d308eb0
Minor tweak to render helpers
jerelmiller Nov 9, 2023
d2333a6
Move new matchers over to own files
jerelmiller Nov 9, 2023
1e10ad5
Ensure toHaveRendered* matchers handle profiled hooks
jerelmiller Nov 9, 2023
a06ea5b
Use profileHook on hook component in first test
jerelmiller Nov 9, 2023
d99abf7
Add helper to create default profiled components
jerelmiller Nov 9, 2023
ee0fe16
Update client override test to use new helpers
jerelmiller Nov 9, 2023
f9571fe
Update existing tests to use new profile helpers
jerelmiller Nov 9, 2023
0a249f7
Create a default profiled error boundary and error fallback and repla…
jerelmiller Nov 9, 2023
69eba8e
Fix TS issue with mocks variable
jerelmiller Nov 9, 2023
264ec3c
Update context test to use profile helpers
jerelmiller Nov 9, 2023
92de850
Convert change to canonicalResults to profile helpers
jerelmiller Nov 9, 2023
93166f1
Update refetchWritePolicy test to use profile helpers
jerelmiller Nov 9, 2023
7f5e931
Use profile helpers for changing returnPartialData
jerelmiller Nov 9, 2023
dec33d7
Update changing fetch policy to use profile helpers
jerelmiller Nov 9, 2023
3fd069b
Update tests refetching to use profile helpers
jerelmiller Nov 9, 2023
9d523c4
Convert test that refetches multiple times to helpers
jerelmiller Nov 9, 2023
78339f1
Use profile helpers for test that checks errors after refetch
jerelmiller Nov 9, 2023
0db74e8
Update test that checks errorPolicy ignore to profile helpers
jerelmiller Nov 9, 2023
7159d9b
Update test that checks errorPolicy all to profile helpers
jerelmiller Nov 9, 2023
b6dab84
Update test that calls refetch with partial data to use profile helpers
jerelmiller Nov 9, 2023
7cdbcd2
Get refetch with startTransition working
jerelmiller Nov 9, 2023
7c0efcb
Create a usePaginatedQueryCase helper
jerelmiller Nov 9, 2023
453ab5d
Update test that checks fetch more with profiler
jerelmiller Nov 9, 2023
4e985ac
Update test for fetchMore + updateQuery to use profiler helpers
jerelmiller Nov 9, 2023
f393b91
Update test that checks fetchMore with fieldPolicies
jerelmiller Nov 9, 2023
afc8af0
Update test that checks startTransition with fetchMore
jerelmiller Nov 9, 2023
0d7f766
Update test that checks refetchWritePolicy to use profile helpers
jerelmiller Nov 9, 2023
9749538
Update test that checks refetchWritePolicy to use profiler
jerelmiller Nov 9, 2023
0430cb6
Update test that checks partialData to use profiler
jerelmiller Nov 9, 2023
479c348
Update test that checks changing variables and partial data
jerelmiller Nov 9, 2023
a168502
Update test that checks network-only with partial data
jerelmiller Nov 9, 2023
7b80be0
Remove unused renderPaginatedTest helper
jerelmiller Nov 9, 2023
0d55f89
Update test that checks returnPartialData and no-cache fetch policy
jerelmiller Nov 10, 2023
651e206
Update test that checks warnings when using no-cache with returnParti…
jerelmiller Nov 10, 2023
8e5ffa6
Update test that checks partial data with cache-and-network
jerelmiller Nov 10, 2023
852e02a
Update test that chekcs changing variables with partial data and cach…
jerelmiller Nov 10, 2023
a683fe9
Update test that checks deferred query with returnPartialData
jerelmiller Nov 10, 2023
500de49
Remove unused helpers in test
jerelmiller Nov 10, 2023
7c28e0b
Remove unused variables and imports
jerelmiller Nov 10, 2023
7c060f9
Use rehackt for useInteractiveQuery
jerelmiller Nov 10, 2023
7b860f7
Import RefetchWritePolicy from core
jerelmiller Nov 10, 2023
85c18dd
Update api report
jerelmiller Nov 10, 2023
d4e9009
Rename useInteractiveQuery to useLoadableQuery
jerelmiller Nov 10, 2023
f372417
Add a changeset
jerelmiller Nov 10, 2023
f2aefcd
Ensure useLoadableQuery is exported from hooks/index.ts
jerelmiller Nov 10, 2023
b42f616
Regenerate API report
jerelmiller Nov 10, 2023
9b15fdc
Update size-limit and include useLoadableQuery
jerelmiller Nov 10, 2023
ad4eabe
Update snapshot test
jerelmiller Nov 10, 2023
3b14e59
Improve TS checks on toHaveRendered and toHaveRenderedTimes matchers
jerelmiller Nov 21, 2023
9ab4e9a
Revert change to toRerender to use peekRender instead of waitForNextR…
jerelmiller Nov 21, 2023
f687f33
Swap order of loadQuery and queryRef values in the return of useLoada…
jerelmiller Nov 21, 2023
e5ed115
Fix toHaveRendered matcher with updated profiler API
jerelmiller Nov 21, 2023
f730fb8
Fix toHaveRenderedTimes matcher to use updated profiler API
jerelmiller Nov 21, 2023
42aae31
Fix missed generic arg passed to UseLoadableQueryResult
jerelmiller Nov 21, 2023
16cd906
Fix misc type errors in useLoadableQuery with strict mode enabled
jerelmiller Nov 21, 2023
69e47ce
Profiler test render tracking (#11378)
phryneas Nov 21, 2023
4479039
Remove duplicate export of RefetchWritePolicy
jerelmiller Nov 21, 2023
3154b3a
Fix types on arguments for class wrapper
jerelmiller Nov 21, 2023
ede5c5d
Update size-limit
jerelmiller Nov 21, 2023
6f27913
Rerun api extractor
jerelmiller Nov 21, 2023
f818768
Add check to ensure hook does not rerender
jerelmiller Nov 21, 2023
b84f0d5
Beef up description of test that was confusing
jerelmiller Nov 21, 2023
9a6c748
Prevent loadQuery from being called in render
jerelmiller Nov 21, 2023
3e68434
Update size-limits
jerelmiller Nov 21, 2023
562c3bb
Make profile return wrapper component without taking internal component
jerelmiller Nov 22, 2023
841a9ef
Rename profile to createTestProfiler
jerelmiller Nov 22, 2023
ed0d2fc
Fix error fallback in default creation
jerelmiller Nov 22, 2023
895792c
Convert additional test to updated API
jerelmiller Nov 22, 2023
ee44633
Rename ProfiledComponent type to Profiler
jerelmiller Nov 22, 2023
2a433a4
Remove unneeded wrapper for tracking renders
jerelmiller Nov 22, 2023
e5efcc9
Don't require args to createTestProfiler
jerelmiller Nov 22, 2023
c39cba0
Fix types on profiled hook
jerelmiller Nov 22, 2023
1e64614
Track component function instead of component name for rendered compo…
jerelmiller Nov 22, 2023
02aa46c
Fix type on matchers
jerelmiller Nov 22, 2023
61443bd
Move render context into own file and add all of context to render in…
jerelmiller Nov 22, 2023
d8c129e
Copy context before passing to RenderInstance
jerelmiller Nov 22, 2023
4914048
Throw if render context is not found
jerelmiller Nov 22, 2023
87bcbb9
Rename useTrackComponentRender to useTrackRender
jerelmiller Nov 22, 2023
a683081
Go back to renderedComponents directly on RenderInstance
jerelmiller Nov 22, 2023
5c562e4
Remove eslint disable
jerelmiller Nov 22, 2023
5e8aadc
Update another test to use new pattern
jerelmiller Nov 22, 2023
79e00f5
Fix usage of profileHook with updates to profiler
jerelmiller Nov 22, 2023
659f884
Fix matchers with updates to profiler
jerelmiller Nov 22, 2023
2a5a487
Update test that checks context to use updated API
jerelmiller Nov 22, 2023
836c1c4
Update another test that checks client overriden to new API
jerelmiller Nov 22, 2023
4d27a07
Update test that checks for cache update
jerelmiller Nov 22, 2023
2b64982
Rename render context to profiler context
jerelmiller Nov 22, 2023
5df75f9
Extract helper to create default profiler for the tests
jerelmiller Nov 22, 2023
c408bed
Convert test that checks for canonical results to new API
jerelmiller Nov 22, 2023
554ecac
Update cache-and-network test to new API
jerelmiller Nov 22, 2023
891183c
Update test that checks for rendered error boundary when refetch throws
jerelmiller Nov 22, 2023
ce05f8a
Update multiple refetch test to use new API
jerelmiller Nov 22, 2023
ccde7cb
Rename createTestProfiler to createProfiler
jerelmiller Nov 27, 2023
0d141df
Recreate profile helper by using createProfiler
jerelmiller Nov 27, 2023
4b9a0ec
Use profile export in tests that previously used it
jerelmiller Nov 27, 2023
18cd0d7
Additional API changes for the test profiler (#11379)
jerelmiller Nov 27, 2023
f9428fc
Allow useTrackRender to accept `name` option to uniquely identify it
jerelmiller Nov 27, 2023
3671d0e
Allow render helpers to take wrapper option
jerelmiller Nov 27, 2023
0d536d4
Render <Profiler /> in the wrapper for each test
jerelmiller Nov 27, 2023
c132c2a
Update test that checks ignore errorPolicy to updated profiler
jerelmiller Nov 27, 2023
41b4c11
Update test that checks errorPolicy: all to updated profiler api
jerelmiller Nov 27, 2023
16b6cb5
Update partial data test with error policy to use new profiler api
jerelmiller Nov 27, 2023
2432df9
Update test that checks fetchMore to updated profiler api
jerelmiller Nov 27, 2023
c2e9dc6
Update test that checks updateQuery to use updated profiler api
jerelmiller Nov 27, 2023
29351ad
Update test that checks field policies with updated profiler api
jerelmiller Nov 27, 2023
6576a59
Update test that checks refetchWritePolicy to updated profiler api
jerelmiller Nov 27, 2023
55fc909
Update test that checks refetchWritePolicy default to updated profile…
jerelmiller Nov 27, 2023
1f59494
Update test that checks partial data in cache to updated profiler api
jerelmiller Nov 27, 2023
453cbb0
Allow strings in rendered components in render tracker
jerelmiller Nov 27, 2023
249ebb5
Update test that checks partial data and changing vars to updated pro…
jerelmiller Nov 27, 2023
7b0caa9
Update test that checks partial data with network-only to updated pro…
jerelmiller Nov 27, 2023
aec18c6
Update test that checks partial data with no-cache to updated profile…
jerelmiller Nov 27, 2023
ed51d0a
Update test that checks partial data with cache-and-network to update…
jerelmiller Nov 27, 2023
b1c1b5e
Update test that checks changing vars with cache-and-network to updat…
jerelmiller Nov 27, 2023
99c0a58
Update test that checks defer with partial data to updated profiler api
jerelmiller Nov 27, 2023
a8676bd
Update test that checks canonical results to updated profiler api
jerelmiller Nov 27, 2023
8f92044
Update test that checks cache data to updated profiler api
jerelmiller Nov 27, 2023
8638291
Update test that checks partial data in cache to updated profiler api
jerelmiller Nov 27, 2023
1c29a35
Update test that checks network-only to updated profiler api
jerelmiller Nov 27, 2023
d2b9b5f
Update test that checks no-cache to updated profiler api
jerelmiller Nov 27, 2023
ae368dd
Update test that checks deferred query with cache data to updated pro…
jerelmiller Nov 27, 2023
adc9b52
Update test that checks updated error policy to updated profiler api
jerelmiller Nov 27, 2023
f987232
Update test that checks updated context to updated profiler api
jerelmiller Nov 28, 2023
fbfea11
Update test that checks change to canonizeResults to updated profiler…
jerelmiller Nov 28, 2023
6a7dc6b
Update test that checks change to refetchWritePolicy to updated profi…
jerelmiller Nov 28, 2023
4f97733
Update test that checks change to returnPartialData to updated profil…
jerelmiller Nov 28, 2023
cc586cb
Update test that checks change to fetchPolicy to updated profiler api
jerelmiller Nov 28, 2023
84b0ec5
Update test that checks resuspending on refetch to updated profiler api
jerelmiller Nov 28, 2023
10c4e7f
Update test that checks refetch with new vars to updated profiler api
jerelmiller Nov 28, 2023
f49bec1
Move OnlyRequiredProperties utility type to src/utilities
jerelmiller Nov 28, 2023
0789e28
Remove toHaveRendered and toHaveRenderedTimes matchers
jerelmiller Nov 28, 2023
40b3678
Rename LoadQuery to LoadQueryFunction and publicly export it
jerelmiller Nov 28, 2023
51d6e92
Extract render dispatcher tracking to internal hook
jerelmiller Nov 28, 2023
fe2cf17
Minor tweak to error message for loadQuery function
jerelmiller Nov 28, 2023
383743d
Prevent act warnings when using Profiler.takeRender
jerelmiller Nov 28, 2023
1a8de39
Add a reset method to loadQuery that sets the queryRef to null and di…
jerelmiller Nov 28, 2023
b7c2dfc
Update api report
jerelmiller Nov 28, 2023
2dc9c8e
Update size limits
jerelmiller Nov 28, 2023
01d6696
Update the changeset to match the updated API
jerelmiller Nov 28, 2023
5c76e4f
Update matcher to allow ProfiledComponent as acceptable value
jerelmiller Nov 28, 2023
8101e02
Pass Profiler directly as the wrapper
jerelmiller Nov 28, 2023
ea821a9
Return function that returns boolean for useRenderGuard
jerelmiller Nov 28, 2023
2e72d53
Create reusable helper to temp disable act warnings
jerelmiller Nov 28, 2023
3c9d236
Rename useTrackRender to useTrackRenders
jerelmiller Nov 28, 2023
7226acd
Use Profiler as wrapper in missed test
jerelmiller Nov 28, 2023
935ff7c
Order takeRender calls in tests in a more logical order
jerelmiller Nov 28, 2023
814ae28
Remove hardcoded size-limit in size-limit.cjs
jerelmiller Nov 28, 2023
5891a06
Merge remote-tracking branch 'origin/release-3.9' into jerel/use-inte…
jerelmiller Nov 28, 2023
3c8113d
Fix syntax error in changeset
jerelmiller Nov 28, 2023
c20e373
Remove unused generic arg on createProfiler
jerelmiller Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 74 additions & 4 deletions .api-reports/api-report-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,38 @@ export type LazyQueryResultTuple<TData, TVariables extends OperationVariables> =
// @public (undocumented)
type Listener<TData> = (promise: Promise<ApolloQueryResult<TData>>) => void;

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

// @public (undocumented)
export interface LoadableQueryHookOptions {
// (undocumented)
canonizeResults?: boolean;
// (undocumented)
client?: ApolloClient<any>;
// (undocumented)
context?: Context;
// Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
errorPolicy?: ErrorPolicy;
// (undocumented)
fetchPolicy?: LoadableQueryHookFetchPolicy;
// (undocumented)
queryKey?: string | number | any[];
// Warning: (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
refetchWritePolicy?: RefetchWritePolicy;
// (undocumented)
returnPartialData?: boolean;
}

// Warning: (ae-forgotten-export) The symbol "OnlyRequiredProperties" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type LoadQueryFunction<TVariables extends OperationVariables> = (...args: [TVariables] extends [never] ? [] : {} extends OnlyRequiredProperties<TVariables> ? [variables?: TVariables] : [variables: TVariables]) => void;

// @public (undocumented)
class LocalState<TCacheShape> {
// Warning: (ae-forgotten-export) The symbol "LocalStateOptions" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -1119,8 +1151,6 @@ interface MutationBaseOptions<TData = any, TVariables = OperationVariables, TCon
awaitRefetchQueries?: boolean;
// (undocumented)
context?: TContext;
// Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
errorPolicy?: ErrorPolicy;
// Warning: (ae-forgotten-export) The symbol "OnQueryUpdated" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -1361,6 +1391,11 @@ export interface OnDataOptions<TData = any> {
data: SubscriptionResult<TData>;
}

// @public (undocumented)
type OnlyRequiredProperties<T> = {
[K in keyof T as {} extends Pick<T, K> ? never : K]: T[K];
};

// @public (undocumented)
type OnQueryUpdated<TResult> = (observableQuery: ObservableQuery<any>, diff: Cache_2.DiffResult<any>, lastDiff: Cache_2.DiffResult<any> | undefined) => boolean | TResult;

Expand Down Expand Up @@ -1800,6 +1835,9 @@ type RequestHandler = (operation: Operation, forward: NextLink) => Observable<Fe
// @public (undocumented)
export const resetApolloContext: typeof getApolloContext;

// @public (undocumented)
type ResetFunction = () => void;

// @public (undocumented)
type Resolver = (rootValue?: any, args?: any, context?: any, info?: {
field: FieldNode;
Expand Down Expand Up @@ -2092,6 +2130,39 @@ export type UseFragmentResult<TData> = {
// @public (undocumented)
export function useLazyQuery<TData = any, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: LazyQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): LazyQueryResultTuple<TData, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData, TVariables extends OperationVariables, TOptions extends LoadableQueryHookOptions>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: LoadableQueryHookOptions & TOptions): UseLoadableQueryResult<TOptions["errorPolicy"] extends "ignore" | "all" ? TOptions["returnPartialData"] extends true ? DeepPartial<TData> | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial<TData> : TData, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: LoadableQueryHookOptions & {
returnPartialData: true;
errorPolicy: "ignore" | "all";
}): UseLoadableQueryResult<DeepPartial<TData> | undefined, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: LoadableQueryHookOptions & {
errorPolicy: "ignore" | "all";
}): UseLoadableQueryResult<TData | undefined, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: LoadableQueryHookOptions & {
returnPartialData: true;
}): UseLoadableQueryResult<DeepPartial<TData>, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: LoadableQueryHookOptions): UseLoadableQueryResult<TData, TVariables>;

// @public (undocumented)
export type UseLoadableQueryResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> = [
LoadQueryFunction<TVariables>,
QueryReference<TData> | null,
{
fetchMore: FetchMoreFunction<TData, TVariables>;
refetch: RefetchFunction<TData, TVariables>;
reset: ResetFunction;
}
];

// @public (undocumented)
export function useMutation<TData = any, TVariables = OperationVariables, TContext = Context, TCache extends ApolloCache<any> = ApolloCache<any>>(mutation: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: MutationHookOptions<NoInfer<TData>, NoInfer<TVariables>, TContext, TCache>): MutationTuple<TData, TVariables, TContext, TCache>;

Expand Down Expand Up @@ -2193,8 +2264,6 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
//
// (undocumented)
nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
// Warning: (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
refetchWritePolicy?: RefetchWritePolicy;
}
Expand All @@ -2221,6 +2290,7 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/watchQueryOptions.ts:191:3 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:26:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:27:3 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useLoadableQuery.ts:51:5 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts
// src/utilities/graphql/DocumentTransform.ts:130:7 - (ae-forgotten-export) The symbol "DocumentTransformCacheKey" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
Expand Down
82 changes: 78 additions & 4 deletions .api-reports/api-report-react_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,40 @@ type LazyQueryResultTuple<TData, TVariables extends OperationVariables> = [LazyQ
// @public (undocumented)
type Listener<TData> = (promise: Promise<ApolloQueryResult<TData>>) => void;

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

// @public (undocumented)
interface LoadableQueryHookOptions {
// (undocumented)
canonizeResults?: boolean;
// (undocumented)
client?: ApolloClient<any>;
// (undocumented)
context?: DefaultContext;
// Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
errorPolicy?: ErrorPolicy;
// Warning: (ae-forgotten-export) The symbol "LoadableQueryHookFetchPolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
fetchPolicy?: LoadableQueryHookFetchPolicy;
// (undocumented)
queryKey?: string | number | any[];
// Warning: (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
refetchWritePolicy?: RefetchWritePolicy;
// (undocumented)
returnPartialData?: boolean;
}

// Warning: (ae-forgotten-export) The symbol "OnlyRequiredProperties" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type LoadQueryFunction<TVariables extends OperationVariables> = (...args: [TVariables] extends [never] ? [] : {} extends OnlyRequiredProperties<TVariables> ? [variables?: TVariables] : [variables: TVariables]) => void;

// @public (undocumented)
class LocalState<TCacheShape> {
// Warning: (ae-forgotten-export) The symbol "LocalStateOptions" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -1070,8 +1104,6 @@ interface MutationBaseOptions<TData = any, TVariables = OperationVariables, TCon
awaitRefetchQueries?: boolean;
// (undocumented)
context?: TContext;
// Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
errorPolicy?: ErrorPolicy;
// Warning: (ae-forgotten-export) The symbol "OnQueryUpdated" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -1310,6 +1342,11 @@ interface OnDataOptions<TData = any> {
data: SubscriptionResult<TData>;
}

// @public (undocumented)
type OnlyRequiredProperties<T> = {
[K in keyof T as {} extends Pick<T, K> ? never : K]: T[K];
};

// @public (undocumented)
type OnQueryUpdated<TResult> = (observableQuery: ObservableQuery<any>, diff: Cache_2.DiffResult<any>, lastDiff: Cache_2.DiffResult<any> | undefined) => boolean | TResult;

Expand Down Expand Up @@ -1696,6 +1733,9 @@ type RefetchWritePolicy = "merge" | "overwrite";
// @public (undocumented)
type RequestHandler = (operation: Operation, forward: NextLink) => Observable<FetchResult> | null;

// @public (undocumented)
type ResetFunction = () => void;

// @public (undocumented)
type Resolver = (rootValue?: any, args?: any, context?: any, info?: {
field: FieldNode;
Expand Down Expand Up @@ -1979,6 +2019,41 @@ export type UseFragmentResult<TData> = {
// @public (undocumented)
export function useLazyQuery<TData = any, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: LazyQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): LazyQueryResultTuple<TData, TVariables>;

// Warning: (ae-forgotten-export) The symbol "LoadableQueryHookOptions" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function useLoadableQuery<TData, TVariables extends OperationVariables, TOptions extends LoadableQueryHookOptions>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: LoadableQueryHookOptions & TOptions): UseLoadableQueryResult<TOptions["errorPolicy"] extends "ignore" | "all" ? TOptions["returnPartialData"] extends true ? DeepPartial<TData> | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial<TData> : TData, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: LoadableQueryHookOptions & {
returnPartialData: true;
errorPolicy: "ignore" | "all";
}): UseLoadableQueryResult<DeepPartial<TData> | undefined, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: LoadableQueryHookOptions & {
errorPolicy: "ignore" | "all";
}): UseLoadableQueryResult<TData | undefined, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: LoadableQueryHookOptions & {
returnPartialData: true;
}): UseLoadableQueryResult<DeepPartial<TData>, TVariables>;

// @public (undocumented)
export function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: LoadableQueryHookOptions): UseLoadableQueryResult<TData, TVariables>;

// @public (undocumented)
export type UseLoadableQueryResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> = [
LoadQueryFunction<TVariables>,
QueryReference<TData> | null,
{
fetchMore: FetchMoreFunction<TData, TVariables>;
refetch: RefetchFunction<TData, TVariables>;
reset: ResetFunction;
}
];

// Warning: (ae-forgotten-export) The symbol "MutationHookOptions" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "MutationTuple" needs to be exported by the entry point index.d.ts
//
Expand Down Expand Up @@ -2087,8 +2162,6 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
//
// (undocumented)
nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
// Warning: (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts
//
// (undocumented)
refetchWritePolicy?: RefetchWritePolicy;
}
Expand All @@ -2115,6 +2188,7 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/watchQueryOptions.ts:191:3 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:26:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:27:3 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useLoadableQuery.ts:51:5 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts
// src/utilities/graphql/DocumentTransform.ts:130:7 - (ae-forgotten-export) The symbol "DocumentTransformCacheKey" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
Expand Down
5 changes: 5 additions & 0 deletions .api-reports/api-report-utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,11 @@ export function offsetLimitPagination<T = Reference>(keyArgs?: KeyArgs): FieldPo
// @public (undocumented)
export function omitDeep<T, K extends string>(value: T, key: K): DeepOmit<T, K>;

// @public (undocumented)
export type OnlyRequiredProperties<T> = {
[K in keyof T as {} extends Pick<T, K> ? never : K]: T[K];
};

// @public (undocumented)
type OnQueryUpdated<TResult> = (observableQuery: ObservableQuery<any>, diff: Cache_2.DiffResult<any>, lastDiff: Cache_2.DiffResult<any> | undefined) => boolean | TResult;

Expand Down
Loading
Loading