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 the ability to preload a query outside of React #11412

Merged
merged 213 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
0f758f7
Initial implementation of query preloader
jerelmiller Nov 29, 2023
0f7616f
Export types from query preloader
jerelmiller Dec 1, 2023
d25d5d9
Add returnPartialData option
jerelmiller Dec 1, 2023
77e11db
Add type tests on preloadQuery for variables argument
jerelmiller Dec 1, 2023
1eb5a96
Add function overloads to handle various options when preloading query
jerelmiller Dec 1, 2023
dd25239
Add .test.tsx suffix to test file
jerelmiller Dec 1, 2023
8300ddc
Only run query preloader tests with React 18
jerelmiller Dec 1, 2023
8cc96d7
Fix regression in variables type
jerelmiller Dec 1, 2023
cf758b2
Pass query as first arg and options as second
jerelmiller Dec 1, 2023
165e0ef
Create prebuilt scenarios that can be used for test cases
jerelmiller Dec 1, 2023
bc1ac5d
Write first test for loading a query outside react
jerelmiller Dec 1, 2023
76426c4
Fix type name in type tests
jerelmiller Dec 1, 2023
cc9c88c
Add another test that checks loading a query with variables
jerelmiller Dec 1, 2023
d72087e
Return dispose as 2nd tuple item and remove refetch/fetchMore
jerelmiller Dec 4, 2023
ca46ed4
Fix incorrect expectation in test
jerelmiller Dec 4, 2023
0739cea
Run prettier
jerelmiller Dec 4, 2023
e01f939
Run prettier on createQueryPreloader
jerelmiller Dec 4, 2023
ff3a6b5
Default to empty queryKey in preloadQuery
jerelmiller Dec 4, 2023
bbea69d
Add test to ensure calling dispose will dispose of the query
jerelmiller Dec 4, 2023
748cfb8
Add ability to determine if the query ref has been disposed
jerelmiller Dec 5, 2023
7b913e7
Warn if using disposed query ref in useReadQuery
jerelmiller Dec 5, 2023
e80697b
Add test to ensure cache updates are handled
jerelmiller Dec 5, 2023
c24075c
Add test to ensure context is passed to the link
jerelmiller Dec 5, 2023
eb0bd84
Add test to ensure errors are thrown and error boundary is shown
jerelmiller Dec 5, 2023
7542b1f
Add test to ensure errorPolicy: 'all' works as expected
jerelmiller Dec 5, 2023
642247c
Add test to ensure errorPolicy: 'ignore' works as expected
jerelmiller Dec 5, 2023
254e0d4
Make dispose query ref warning a dev only warning
jerelmiller Dec 6, 2023
fe49b45
Fix description of test to match test implementation
jerelmiller Dec 6, 2023
1238ab4
Add test to ensure queryKey is respected
jerelmiller Dec 6, 2023
418c29a
Add test to ensure returnPartialData works as expected
jerelmiller Dec 6, 2023
69d363b
Refactor tests to use common setup
jerelmiller Dec 6, 2023
342a27d
Add error boundary to default test app
jerelmiller Dec 6, 2023
5fdf1a8
Move everything into createDefaultTestApp
jerelmiller Dec 6, 2023
31fb337
Create new render helper that renders default app
jerelmiller Dec 6, 2023
f746ea6
Combine renderDefaultTestApp with renderDefaultTestApp
jerelmiller Dec 6, 2023
352eee1
Combine renderWithClient and renderDefaultTestApp
jerelmiller Dec 6, 2023
f96ed34
Add test to ensure canonizeResults can be set
jerelmiller Dec 6, 2023
5d35f83
Add test to ensure canonical results can be disabled
jerelmiller Dec 6, 2023
a4c577e
Fix formatting in scenarios file
jerelmiller Dec 6, 2023
a1c2e4c
Add test to ensure network-only fetch policy is honored
jerelmiller Dec 6, 2023
7bad689
Add test for cache-and-network
jerelmiller Dec 6, 2023
00c36e3
Add test to ensure cached data is returned immediately
jerelmiller Dec 6, 2023
085fd05
Add test to ensure partial data in cache is ignored
jerelmiller Dec 6, 2023
5505479
Minor tweak to test description
jerelmiller Dec 6, 2023
4674fa0
Add test to ensure deferred queries work as expected
jerelmiller Dec 6, 2023
4cdcf96
Add first test and implementation for usePreloadedQueryHandlers
jerelmiller Dec 6, 2023
aaf4b85
Add transition support for usePreloadedQueryHandlers
jerelmiller Dec 7, 2023
afc56e7
Add test to ensure usePreloadedQueryHandlers does not overwrite promise
jerelmiller Dec 7, 2023
3b29723
Remove updateOptions function for now
jerelmiller Dec 7, 2023
583d47a
Minor adjustment to test description
jerelmiller Dec 7, 2023
ec3c615
Add TVariables to QueryReference
jerelmiller Dec 7, 2023
a1ef63e
Infer TVariables from QueryReference for usePreloadedQueryHandlers
jerelmiller Dec 7, 2023
9cdbc30
Add tests to ensure refetchWritePolicy works correctly
jerelmiller Dec 7, 2023
447194c
Publicly export usePreloadedQueryHandlers
jerelmiller Dec 7, 2023
90e280f
Update snapshot exports tests
jerelmiller Dec 7, 2023
2270972
WIP changeset
jerelmiller Dec 7, 2023
3c2a6d8
Merge branch 'release-3.9' into jerel/load-query-outside-react
jerelmiller Dec 7, 2023
59f25e0
Include a retain function on the wrapped query ref
jerelmiller Dec 7, 2023
489dddf
Don't auto retain query ref when preloading
jerelmiller Dec 7, 2023
ebbea5f
Add todo tests for retaining
jerelmiller Dec 7, 2023
13c4e9a
Remove never variable types in type tests
jerelmiller Dec 7, 2023
f108a2d
Update usePreloadedQueryHandlers tests to use new signature
jerelmiller Dec 7, 2023
3122df4
Auto retain queryRef in useReadQuery
jerelmiller Dec 7, 2023
cf10e84
Remove deleted export from query preloader
jerelmiller Dec 7, 2023
ef13893
Remove extra newlines in warning
jerelmiller Dec 7, 2023
88ceeff
Fix more references to TVariables for QueryReference
jerelmiller Dec 7, 2023
0a80d4f
Add a toPromise function with some tests
jerelmiller Dec 7, 2023
3ae9a52
Fix ts issues from change to TVariables
jerelmiller Dec 7, 2023
5a2de9f
Default to any for QueryReference TVariables
jerelmiller Dec 7, 2023
d05316d
Simplify types to get it working
jerelmiller Dec 8, 2023
feb37e2
Remove query reference test for now
jerelmiller Dec 9, 2023
0cce22f
Only support toPromise without maxTime
jerelmiller Dec 9, 2023
ec28228
Remove unneeded arg to getWrappedPromise
jerelmiller Dec 9, 2023
844551d
move promise unwrapping to toPromise function on the query ref
jerelmiller Dec 9, 2023
d3dc0b8
Return generic promise from toPromise
jerelmiller Dec 9, 2023
ea14e6e
Remove unneeded TVariables on unwrapQueryRef
jerelmiller Dec 9, 2023
b5aef12
Remove unneded TVaraibles from queryRef arg to updateWrappedQueryRef
jerelmiller Dec 9, 2023
a1b834a
Simplify internal FetchMoreOptions
jerelmiller Dec 9, 2023
2bb69e4
Remove unneeded type cast in SuspenseCache
jerelmiller Dec 9, 2023
75ba7ea
Remove unused import in QueryReference
jerelmiller Dec 9, 2023
76f5d62
Add tests that ensure usePreloadedQueryHandlers can attach to queryRe…
jerelmiller Dec 9, 2023
4fed642
Convert transition test to profiler
jerelmiller Dec 9, 2023
330d6ad
Add test and fix to ensure usePreloadedQueryHandlers refetch can be c…
jerelmiller Dec 9, 2023
e284c6f
Rename usePreloadedQueryHandlers to useQueryRefHandlers
jerelmiller Dec 9, 2023
09d7451
Rerun exports
jerelmiller Dec 9, 2023
8da55d2
Add render helpers in testing utils
jerelmiller Dec 11, 2023
26fb4ef
Use renderWithClient helper in useQueryRefHandlers
jerelmiller Dec 11, 2023
558f0a1
Calling retain on a disposed query ref does nothing
jerelmiller Dec 11, 2023
6cb99e5
Fix query preloader test due to changes in API
jerelmiller Dec 11, 2023
f0d2f97
Merge branch 'release-3.9' into jerel/load-query-outside-react
jerelmiller Dec 11, 2023
4f3806a
Use renderHook for dispose test
jerelmiller Dec 11, 2023
4d77d9b
Warn again when passing a different disposed query ref to useReadQuery
jerelmiller Dec 11, 2023
fc757b1
Add test to ensure auto dispose timer kicks in on preloading
jerelmiller Dec 11, 2023
51df7c2
Add test to ensure configured auto dispose timer is honored
jerelmiller Dec 11, 2023
e755d82
Add test to ensure useReadQuery auto retains the query ref
jerelmiller Dec 11, 2023
19e1056
Add test to ensure manual retain and useReadQuery work correctly
jerelmiller Dec 11, 2023
7561ee9
Fix variables type errors when other options are present
jerelmiller Dec 11, 2023
74d248c
Use Record<string, never> for never variables type
jerelmiller Dec 11, 2023
482dc88
Use Record<string, never> in simple variables case
jerelmiller Dec 11, 2023
a768c9e
Add a couple more type tests for other options with variables
jerelmiller Dec 11, 2023
5abedcd
Update type tests to test for explicit type args
jerelmiller Dec 11, 2023
bf2da75
Add warning when calling retain on a disposed queryRef
jerelmiller Dec 11, 2023
ee38f4c
Add any to ObservableQuery type on constructor in InternalQueryReference
jerelmiller Dec 11, 2023
29fce00
Tweak warning message in useReadQuery
jerelmiller Dec 11, 2023
005c013
Only retain the queryRef if not already disposed
jerelmiller Dec 11, 2023
6ce3304
Add test to ensure disposing of query after mounting useReadQuery works
jerelmiller Dec 11, 2023
62b6e9c
Add paginated case to scenarios
jerelmiller Dec 11, 2023
2c9dec2
Slight test reorg
jerelmiller Dec 11, 2023
9b60a74
Small test description update
jerelmiller Dec 11, 2023
1bc7cc8
Add tests to ensure fetchMore works with useQueryRefHandlers
jerelmiller Dec 11, 2023
41d0123
Add tests to ensure useQueryRefHandlers can call fetchMore from uBQ a…
jerelmiller Dec 11, 2023
516c24e
Add test to ensure fetchMore works with startTransition
jerelmiller Dec 11, 2023
23ca5ff
Minor tweak to simplify test
jerelmiller Dec 11, 2023
70ce235
Inline creation of client in test
jerelmiller Dec 11, 2023
74689b4
Add custom matcher to determine if query ref was disposed
jerelmiller Dec 12, 2023
f402d6a
Use toBeDisposed in createQueryPreloader tests
jerelmiller Dec 12, 2023
0f1c130
Move preloadQuery types into exported interface
jerelmiller Dec 12, 2023
10c6db9
Use invariant from ts-invariant
jerelmiller Dec 12, 2023
d353057
Don't use invariant in toBeDisposed
jerelmiller Dec 12, 2023
a61e353
Import getSuspenseCache from cache/index.js
jerelmiller Dec 12, 2023
51ac881
Ensure mocks are used for renderWithMocks helper
jerelmiller Dec 12, 2023
f0462e7
Better changeset
jerelmiller Dec 12, 2023
3178fa1
Update API report
jerelmiller Dec 12, 2023
e660027
update size-limits
phryneas Dec 12, 2023
17f561a
Remove getWrappedPromise which is not used
jerelmiller Dec 12, 2023
c4f2c67
Use variable to reference promise from toPromise to avoid function cr…
jerelmiller Dec 12, 2023
513542b
Swap order of query options spread to prevent accidental overriding o…
jerelmiller Dec 12, 2023
7a68c5c
Use setup prefix with scenario helpers instead of use
jerelmiller Dec 12, 2023
c5b1bae
Add tsdoc to the preloadQuery API
jerelmiller Dec 13, 2023
94e5b94
Add tsdoc for preloadQuery options
jerelmiller Dec 13, 2023
d145cf3
Add param and return value to createQueryPreloader
jerelmiller Dec 13, 2023
854672a
Don't add query created by preloadQuery to suspense cache. This remov…
jerelmiller Dec 13, 2023
8f773f9
Return preloadQuery directly
jerelmiller Dec 13, 2023
8af25a5
Remove tsdoc inline with preloadQuery function
jerelmiller Dec 13, 2023
712a49f
Update api report
jerelmiller Dec 13, 2023
4534b15
Update size limits
jerelmiller Dec 13, 2023
4a1d7b0
Try to fix reference to docs for API report
jerelmiller Dec 13, 2023
d2f4ffa
Simplify preloadQuery even further
jerelmiller Dec 13, 2023
613a880
Add test to ensure query ref kicks off request immediately
jerelmiller Dec 14, 2023
c0c6e93
Write a test that checks auto resubscribe behavior
jerelmiller Dec 14, 2023
c722efe
Add implementation to make auto subscribe work
jerelmiller Dec 14, 2023
34860ac
Remove need for disposed warning
jerelmiller Dec 14, 2023
1b3e9c0
Fix edge case when resubscribing
jerelmiller Dec 14, 2023
e7eb9e9
No need to check if disposed
jerelmiller Dec 14, 2023
a67a970
Remove __disposed state
jerelmiller Dec 14, 2023
20adcd5
Add fix for toBeDisposed on queryRef
jerelmiller Dec 14, 2023
ca88345
Remove the retain API from queryRef
jerelmiller Dec 14, 2023
db1bbff
Add implementation to get network-only working correctly
jerelmiller Dec 14, 2023
b1572cf
Minor tweak to how results are checked
jerelmiller Dec 15, 2023
84cddd7
Add observer before subscribing to avoid reobserve call
jerelmiller Dec 15, 2023
5d682a6
Add test to ensure no-cache works as expected
jerelmiller Dec 15, 2023
f50a6b1
Only run some updates for non no-cache
jerelmiller Dec 15, 2023
9d25556
Minor comments for no-cache case
jerelmiller Dec 15, 2023
c388607
Add test to ensure cache-and-network functions as expected
jerelmiller Dec 15, 2023
62f46e5
change re-subscription order
phryneas Dec 15, 2023
14d680a
fix up no-cache
phryneas Dec 15, 2023
8cd67f0
Merge pull request #11431 from apollographql/pr/fix-resubscribe
jerelmiller Dec 15, 2023
87190af
Move observer to subscribe directly
jerelmiller Dec 15, 2023
3b767df
Use wait helper in test
jerelmiller Dec 15, 2023
357c506
Rename count to fetchCount
jerelmiller Dec 15, 2023
cd45537
Immediately count fetches in all tests
jerelmiller Dec 15, 2023
7d61089
Add fetch count assertions
jerelmiller Dec 15, 2023
0d76f89
Add test and implementaiton to ensure returnPartialData works as expe…
jerelmiller Dec 15, 2023
216e449
Add __typename to return of variables data
jerelmiller Dec 15, 2023
ba64926
Use callback to update promise
jerelmiller Dec 15, 2023
14a5a16
Rename forceDiff to resetDiff and only clear lastDiff to do it
jerelmiller Dec 15, 2023
aadb17a
Refactor query subscription to own method
jerelmiller Dec 15, 2023
51a1ac5
Ensure returnPartialData with no cache data will suspend and load
jerelmiller Dec 15, 2023
6caa8c9
Refactor partial result to own function
jerelmiller Dec 15, 2023
476504b
Use try/finally to reset original fetch policy
jerelmiller Dec 15, 2023
64b90e8
Refactor to flatten out nested ifs
jerelmiller Dec 15, 2023
3eab834
Don't pass arg to isPartialResult
jerelmiller Dec 15, 2023
64f30e9
Rename isPartialResult to isFullOrPartialResult and remove need for i…
jerelmiller Dec 15, 2023
59c7d0f
Refactor setting of status and promise to common function
jerelmiller Dec 15, 2023
eb06ee3
Refactor common code into single function
jerelmiller Dec 15, 2023
9a97fa2
Rename setResult to reinitialize
jerelmiller Dec 15, 2023
b7fabaf
Remove status in favor of reading promise status
jerelmiller Dec 15, 2023
07035ca
Refactor more common logic into own function
jerelmiller Dec 15, 2023
26250ea
Add disposed back. Check if first disposed before calling reinitialize
jerelmiller Dec 15, 2023
142c0e3
Remove test that checks warning for retain on disposed query ref
jerelmiller Dec 15, 2023
74223dc
Go back to reading .disposed in toBeDisposed
jerelmiller Dec 15, 2023
413925b
Use shorthand to subscribe
jerelmiller Dec 15, 2023
c873ac8
Remove variable in favor of inlining it
jerelmiller Dec 15, 2023
8fa119a
Remove leftover comments
jerelmiller Dec 15, 2023
f58324e
Remove useless comment
jerelmiller Dec 15, 2023
1084597
Mark createQueryPreloader as experimental
jerelmiller Dec 15, 2023
d761e68
Regenerate api report
jerelmiller Dec 15, 2023
8500ab0
Resolve toPromise with undefined to prevent use of server data
jerelmiller Dec 15, 2023
fe9b8fa
Update useBackgroundQuery tests that rely on promise
jerelmiller Dec 15, 2023
6ca6a26
Resolve with the queryRef itself
jerelmiller Dec 15, 2023
1b5600b
Update api report
jerelmiller Dec 15, 2023
3093fbb
Update size-limit
jerelmiller Dec 15, 2023
84ffc0f
Fix typo in comment
jerelmiller Dec 15, 2023
45dce86
Remove extra var by inlining logic
jerelmiller Dec 16, 2023
71e5ac9
Compute disposed from he subscription
jerelmiller Dec 16, 2023
56fdc23
No need for null subscription
jerelmiller Dec 16, 2023
05f48e5
Regenerate size limits
jerelmiller Dec 16, 2023
54fc0da
Merge branch 'release-3.9' into jerel/load-query-outside-react
jerelmiller Dec 16, 2023
398078f
Regenerate size limits
jerelmiller Dec 16, 2023
c74df6e
Fix typo in comment
jerelmiller Dec 16, 2023
eff139b
Adjust some types in type tests for preloadQuery
jerelmiller Dec 18, 2023
241f43b
Clean up Prettier, Size-limit, and Api-Extractor
jerelmiller Dec 18, 2023
f5fb0e9
Ensure preloadQuery overloads have proper inheritDoc comments
jerelmiller Dec 18, 2023
1fa89fd
Add tsdoc to useQueryRefHandlers
jerelmiller Dec 18, 2023
3edd825
Clean up Prettier, Size-limit, and Api-Extractor
jerelmiller Dec 18, 2023
9924df7
Ensure interface declarations handle inheritDoc
jerelmiller Dec 18, 2023
f7cb4b0
Clean up Prettier, Size-limit, and Api-Extractor
jerelmiller Dec 18, 2023
39d381d
Fix link ref in createQueryPreloader
jerelmiller Dec 18, 2023
11ab8b0
Clean up Prettier, Size-limit, and Api-Extractor
jerelmiller Dec 18, 2023
fb1c6ba
Fix link ref in createQueryPreloader
jerelmiller Dec 18, 2023
7180415
Clean up Prettier, Size-limit, and Api-Extractor
jerelmiller Dec 18, 2023
5a78004
Add a changeset for useQueryRefHandlers
jerelmiller Dec 18, 2023
937ddda
Slight tweak to useQueryRefHandlers tsdoc and add example
jerelmiller Dec 18, 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
4 changes: 4 additions & 0 deletions .api-reports/api-report-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,8 @@ export class ObservableQuery<TData = any, TVariables extends OperationVariables
//
// (undocumented)
reobserveAsConcast(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Concast<ApolloQueryResult<TData>>;
// @internal (undocumented)
resetDiff(): void;
// (undocumented)
resetLastResults(): void;
// (undocumented)
Expand Down Expand Up @@ -1690,6 +1692,8 @@ class QueryInfo {
// (undocumented)
reset(): void;
// (undocumented)
resetDiff(): void;
// (undocumented)
resetLastWrite(): void;
// (undocumented)
setDiff(diff: Cache_2.DiffResult<any> | null): void;
Expand Down
106 changes: 94 additions & 12 deletions .api-reports/api-report-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,9 @@ type ConcastSourcesIterable<T> = Iterable<Source<T>>;
export interface Context extends Record<string, any> {
}

// @public
export function createQueryPreloader(client: ApolloClient<any>): PreloadQueryFunction;

// @public (undocumented)
namespace DataProxy {
// (undocumented)
Expand Down Expand Up @@ -936,13 +939,15 @@ interface IncrementalPayload<TData, TExtensions> {
// @public (undocumented)
class InternalQueryReference<TData = unknown> {
// Warning: (ae-forgotten-export) The symbol "InternalQueryReferenceOptions" needs to be exported by the entry point index.d.ts
constructor(observable: ObservableQuery<TData>, options: InternalQueryReferenceOptions);
constructor(observable: ObservableQuery<TData, any>, options: InternalQueryReferenceOptions);
// (undocumented)
applyOptions(watchQueryOptions: ObservedOptions): QueryRefPromise<TData>;
// Warning: (ae-forgotten-export) The symbol "ObservedOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
didChangeOptions(watchQueryOptions: ObservedOptions): boolean;
// (undocumented)
get disposed(): boolean;
// Warning: (ae-forgotten-export) The symbol "FetchMoreOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand All @@ -964,6 +969,8 @@ class InternalQueryReference<TData = unknown> {
// (undocumented)
refetch(variables: OperationVariables | undefined): Promise<ApolloQueryResult<TData>>;
// (undocumented)
reinitialize(): void;
// (undocumented)
result: ApolloQueryResult<TData>;
// (undocumented)
retain(): () => void;
Expand Down Expand Up @@ -1347,6 +1354,8 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera
//
// (undocumented)
reobserveAsConcast(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Concast<ApolloQueryResult<TData>>;
// @internal (undocumented)
resetDiff(): void;
// (undocumented)
resetLastResults(): void;
// (undocumented)
Expand Down Expand Up @@ -1451,6 +1460,47 @@ interface PendingPromise<TValue> extends Promise<TValue> {
status: "pending";
}

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

// @public
export interface PreloadQueryFunction {
// Warning: (ae-forgotten-export) The symbol "PreloadQueryOptionsArg" needs to be exported by the entry point index.d.ts
<TData, TVariables extends OperationVariables, TOptions extends Omit<PreloadQueryOptions, "variables">>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>, TOptions>): QueryReference<TOptions["errorPolicy"] extends "ignore" | "all" ? TOptions["returnPartialData"] extends true ? DeepPartial<TData> | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial<TData> : TData, TVariables>;
<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: PreloadQueryOptions<NoInfer<TVariables>> & {
returnPartialData: true;
errorPolicy: "ignore" | "all";
}): QueryReference<DeepPartial<TData> | undefined, TVariables>;
<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: PreloadQueryOptions<NoInfer<TVariables>> & {
errorPolicy: "ignore" | "all";
}): QueryReference<TData | undefined, TVariables>;
<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: PreloadQueryOptions<NoInfer<TVariables>> & {
returnPartialData: true;
}): QueryReference<DeepPartial<TData>, TVariables>;
<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>>): QueryReference<TData, TVariables>;
}

// Warning: (ae-forgotten-export) The symbol "VariablesOption" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type PreloadQueryOptions<TVariables extends OperationVariables = OperationVariables> = {
canonizeResults?: boolean;
context?: Context;
errorPolicy?: ErrorPolicy;
fetchPolicy?: PreloadQueryFetchPolicy;
returnPartialData?: boolean;
refetchWritePolicy?: RefetchWritePolicy;
} & VariablesOption<TVariables>;

// @public (undocumented)
type PreloadQueryOptionsArg<TVariables extends OperationVariables, TOptions = unknown> = [TVariables] extends [never] ? [
options?: PreloadQueryOptions<never> & TOptions
] : {} extends OnlyRequiredProperties<TVariables> ? [
options?: PreloadQueryOptions<NoInfer<TVariables>> & Omit<TOptions, "variables">
] : [
options: PreloadQueryOptions<NoInfer<TVariables>> & Omit<TOptions, "variables">
];

// @public (undocumented)
type Primitive = null | undefined | string | number | boolean | symbol | bigint;

Expand Down Expand Up @@ -1543,6 +1593,8 @@ class QueryInfo {
// (undocumented)
reset(): void;
// (undocumented)
resetDiff(): void;
// (undocumented)
resetLastWrite(): void;
// (undocumented)
setDiff(diff: Cache_2.DiffResult<any> | null): void;
Expand Down Expand Up @@ -1716,13 +1768,15 @@ interface QueryOptions<TVariables = OperationVariables, TData = any> {
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The reference is ambiguous because "useBackgroundQuery" has more than one declaration; you need to add a TSDoc member reference selector
//
// @public
export interface QueryReference<TData = unknown> {
export interface QueryReference<TData = unknown, TVariables = unknown> {
// (undocumented)
[PROMISE_SYMBOL]: QueryRefPromise<TData>;
// Warning: (ae-forgotten-export) The symbol "InternalQueryReference" needs to be exported by the entry point index.d.ts
//
// (undocumented)
readonly [QUERY_REFERENCE_SYMBOL]: InternalQueryReference<TData>;
// (undocumented)
toPromise(): Promise<QueryReference<TData, TVariables>>;
}

// Warning: (ae-forgotten-export) The symbol "PromiseWithState" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -2072,7 +2126,7 @@ export function useApolloClient(override?: ApolloClient<object>): ApolloClient<o
//
// @public (undocumented)
export function useBackgroundQuery<TData, TVariables extends OperationVariables, TOptions extends Omit<BackgroundQueryHookOptions<TData>, "variables">>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & TOptions): [
(QueryReference<TOptions["errorPolicy"] extends "ignore" | "all" ? TOptions["returnPartialData"] extends true ? DeepPartial<TData> | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial<TData> : TData> | (TOptions["skip"] extends boolean ? undefined : never)),
(QueryReference<TOptions["errorPolicy"] extends "ignore" | "all" ? TOptions["returnPartialData"] extends true ? DeepPartial<TData> | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial<TData> : TData, TVariables> | (TOptions["skip"] extends boolean ? undefined : never)),
UseBackgroundQueryResult<TData, TVariables>
];

Expand All @@ -2081,15 +2135,15 @@ export function useBackgroundQuery<TData = unknown, TVariables extends Operation
returnPartialData: true;
errorPolicy: "ignore" | "all";
}): [
QueryReference<DeepPartial<TData> | undefined>,
QueryReference<DeepPartial<TData> | undefined, TVariables>,
UseBackgroundQueryResult<TData, TVariables>
];

// @public (undocumented)
export function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
errorPolicy: "ignore" | "all";
}): [
QueryReference<TData | undefined>,
QueryReference<TData | undefined, TVariables>,
UseBackgroundQueryResult<TData, TVariables>
];

Expand All @@ -2098,28 +2152,31 @@ export function useBackgroundQuery<TData = unknown, TVariables extends Operation
skip: boolean;
returnPartialData: true;
}): [
QueryReference<DeepPartial<TData>> | undefined,
QueryReference<DeepPartial<TData>, TVariables> | undefined,
UseBackgroundQueryResult<TData, TVariables>
];

// @public (undocumented)
export function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
returnPartialData: true;
}): [
QueryReference<DeepPartial<TData>>,
QueryReference<DeepPartial<TData>, TVariables>,
UseBackgroundQueryResult<TData, TVariables>
];

// @public (undocumented)
export function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
skip: boolean;
}): [
QueryReference<TData> | undefined,
QueryReference<TData, TVariables> | undefined,
UseBackgroundQueryResult<TData, TVariables>
];

// @public (undocumented)
export function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables>): [QueryReference<TData>, UseBackgroundQueryResult<TData, TVariables>];
export function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables>): [
QueryReference<TData, TVariables>,
UseBackgroundQueryResult<TData, TVariables>
];

// @public (undocumented)
export function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): [undefined, UseBackgroundQueryResult<TData, TVariables>];
Expand All @@ -2128,13 +2185,13 @@ export function useBackgroundQuery<TData = unknown, TVariables extends Operation
export function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
returnPartialData: true;
})): [
QueryReference<DeepPartial<TData>> | undefined,
QueryReference<DeepPartial<TData>, TVariables> | undefined,
UseBackgroundQueryResult<TData, TVariables>
];

// @public (undocumented)
export function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: SkipToken | BackgroundQueryHookOptionsNoInfer<TData, TVariables>): [
QueryReference<TData> | undefined,
QueryReference<TData, TVariables> | undefined,
UseBackgroundQueryResult<TData, TVariables>
];

Expand Down Expand Up @@ -2194,7 +2251,7 @@ export function useLoadableQuery<TData = unknown, TVariables extends OperationVa
// @public (undocumented)
export type UseLoadableQueryResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> = [
LoadQueryFunction<TVariables>,
QueryReference<TData> | null,
QueryReference<TData, TVariables> | null,
{
fetchMore: FetchMoreFunction<TData, TVariables>;
refetch: RefetchFunction<TData, TVariables>;
Expand All @@ -2208,6 +2265,17 @@ export function useMutation<TData = any, TVariables = OperationVariables, TConte
// @public (undocumented)
export function useQuery<TData = any, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): QueryResult<TData, TVariables>;

// @public
export function useQueryRefHandlers<TData = unknown, TVariables extends OperationVariables = OperationVariables>(queryRef: QueryReference<TData, TVariables>): UseQueryRefHandlersResult<TData, TVariables>;

// @public (undocumented)
export interface UseQueryRefHandlersResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
// (undocumented)
fetchMore: FetchMoreFunction<TData, TVariables>;

refetch: RefetchFunction<TData, TVariables>;
}

// Warning: (ae-forgotten-export) The symbol "ReactiveVar" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
Expand Down Expand Up @@ -2287,6 +2355,17 @@ export interface UseSuspenseQueryResult<TData = unknown, TVariables extends Oper
subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
}

// @public (undocumented)
type VariablesOption<TVariables extends OperationVariables> = [
TVariables
] extends [never] ? {
variables?: Record<string, never>;
} : {} extends OnlyRequiredProperties<TVariables> ? {
variables?: TVariables;
} : {
variables: TVariables;
};

// @public (undocumented)
type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network";

Expand Down Expand Up @@ -2336,6 +2415,9 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/react/hooks/useBackgroundQuery.ts:30:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:31:3 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useLoadableQuery.ts:50:5 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts
// src/react/query-preloader/createQueryPreloader.ts:76:1 - (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "NetworkStatus"
// src/react/query-preloader/createQueryPreloader.ts:79:5 - (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ErrorPolicy"
// src/react/query-preloader/createQueryPreloader.ts:84:5 - (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "FetchPolicy"

// (No @packageDocumentation comment for this package)

Expand Down
4 changes: 4 additions & 0 deletions .api-reports/api-report-react_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,8 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera
//
// (undocumented)
reobserveAsConcast(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Concast<ApolloQueryResult<TData>>;
// @internal (undocumented)
resetDiff(): void;
// (undocumented)
resetLastResults(): void;
// (undocumented)
Expand Down Expand Up @@ -1299,6 +1301,8 @@ class QueryInfo {
// (undocumented)
reset(): void;
// (undocumented)
resetDiff(): void;
// (undocumented)
resetLastWrite(): void;
// (undocumented)
setDiff(diff: Cache_2.DiffResult<any> | null): void;
Expand Down
4 changes: 4 additions & 0 deletions .api-reports/api-report-react_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,8 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera
//
// (undocumented)
reobserveAsConcast(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Concast<ApolloQueryResult<TData>>;
// @internal (undocumented)
resetDiff(): void;
// (undocumented)
resetLastResults(): void;
// (undocumented)
Expand Down Expand Up @@ -1207,6 +1209,8 @@ class QueryInfo {
// (undocumented)
reset(): void;
// (undocumented)
resetDiff(): void;
// (undocumented)
resetLastWrite(): void;
// (undocumented)
setDiff(diff: Cache_2.DiffResult<any> | null): void;
Expand Down
4 changes: 4 additions & 0 deletions .api-reports/api-report-react_hoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,8 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera
//
// (undocumented)
reobserveAsConcast(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Concast<ApolloQueryResult<TData>>;
// @internal (undocumented)
resetDiff(): void;
// (undocumented)
resetLastResults(): void;
// (undocumented)
Expand Down Expand Up @@ -1276,6 +1278,8 @@ class QueryInfo {
// (undocumented)
reset(): void;
// (undocumented)
resetDiff(): void;
// (undocumented)
resetLastWrite(): void;
// (undocumented)
setDiff(diff: Cache_2.DiffResult<any> | null): void;
Expand Down
Loading
Loading