@@ -23,31 +23,32 @@ await queryClient.prefetchQuery('posts', fetchPosts)
2323
2424Its available methods are:
2525
26- - [ ` queryClient.fetchQuery ` ] ( #queryclientfetchquery )
27- - [ ` queryClient.fetchInfiniteQuery ` ] ( #queryclientfetchinfinitequery )
28- - [ ` queryClient.prefetchQuery ` ] ( #queryclientprefetchquery )
29- - [ ` queryClient.prefetchInfiniteQuery ` ] ( #queryclientprefetchinfinitequery )
30- - [ ` queryClient.getQueryData ` ] ( #queryclientgetquerydata )
31- - [ ` queryClient.getQueriesData ` ] ( #queryclientgetqueriesdata )
32- - [ ` queryClient.setQueryData ` ] ( #queryclientsetquerydata )
33- - [ ` queryClient.getQueryState ` ] ( #queryclientgetquerystate )
34- - [ ` queryClient.setQueriesData ` ] ( #queryclientsetqueriesdata )
35- - [ ` queryClient.invalidateQueries ` ] ( #queryclientinvalidatequeries )
36- - [ ` queryClient.refetchQueries ` ] ( #queryclientrefetchqueries )
37- - [ ` queryClient.cancelQueries ` ] ( #queryclientcancelqueries )
38- - [ ` queryClient.removeQueries ` ] ( #queryclientremovequeries )
39- - [ ` queryClient.resetQueries ` ] ( #queryclientresetqueries )
40- - [ ` queryClient.isFetching ` ] ( #queryclientisfetching )
41- - [ ` queryClient.isMutating ` ] ( #queryclientismutating )
42- - [ ` queryClient.getDefaultOptions ` ] ( #queryclientgetdefaultoptions )
43- - [ ` queryClient.setDefaultOptions ` ] ( #queryclientsetdefaultoptions )
44- - [ ` queryClient.getQueryDefaults ` ] ( #queryclientgetquerydefaults )
45- - [ ` queryClient.setQueryDefaults ` ] ( #queryclientsetquerydefaults )
46- - [ ` queryClient.getMutationDefaults ` ] ( #queryclientgetmutationdefaults )
47- - [ ` queryClient.setMutationDefaults ` ] ( #queryclientsetmutationdefaults )
48- - [ ` queryClient.getQueryCache ` ] ( #queryclientgetquerycache )
49- - [ ` queryClient.getMutationCache ` ] ( #queryclientgetmutationcache )
50- - [ ` queryClient.clear ` ] ( #queryclientclear )
26+ * [ ` QueryClient ` ] ( #queryclient )
27+ * [ ` queryClient.fetchQuery ` ] ( #queryclientfetchquery )
28+ * [ ` queryClient.fetchInfiniteQuery ` ] ( #queryclientfetchinfinitequery )
29+ * [ ` queryClient.prefetchQuery ` ] ( #queryclientprefetchquery )
30+ * [ ` queryClient.prefetchInfiniteQuery ` ] ( #queryclientprefetchinfinitequery )
31+ * [ ` queryClient.getQueryData ` ] ( #queryclientgetquerydata )
32+ * [ ` queryClient.getQueriesData ` ] ( #queryclientgetqueriesdata )
33+ * [ ` queryClient.setQueryData ` ] ( #queryclientsetquerydata )
34+ * [ ` queryClient.getQueryState ` ] ( #queryclientgetquerystate )
35+ * [ ` queryClient.setQueriesData ` ] ( #queryclientsetqueriesdata )
36+ * [ ` queryClient.invalidateQueries ` ] ( #queryclientinvalidatequeries )
37+ * [ ` queryClient.refetchQueries ` ] ( #queryclientrefetchqueries )
38+ * [ ` queryClient.cancelQueries ` ] ( #queryclientcancelqueries )
39+ * [ ` queryClient.removeQueries ` ] ( #queryclientremovequeries )
40+ * [ ` queryClient.resetQueries ` ] ( #queryclientresetqueries )
41+ * [ ` queryClient.isFetching ` ] ( #queryclientisfetching )
42+ * [ ` queryClient.isMutating ` ] ( #queryclientismutating )
43+ * [ ` queryClient.getDefaultOptions ` ] ( #queryclientgetdefaultoptions )
44+ * [ ` queryClient.setDefaultOptions ` ] ( #queryclientsetdefaultoptions )
45+ * [ ` queryClient.getQueryDefaults ` ] ( #queryclientgetquerydefaults )
46+ * [ ` queryClient.setQueryDefaults ` ] ( #queryclientsetquerydefaults )
47+ * [ ` queryClient.getMutationDefaults ` ] ( #queryclientgetmutationdefaults )
48+ * [ ` queryClient.setMutationDefaults ` ] ( #queryclientsetmutationdefaults )
49+ * [ ` queryClient.getQueryCache ` ] ( #queryclientgetquerycache )
50+ * [ ` queryClient.getMutationCache ` ] ( #queryclientgetmutationcache )
51+ * [ ` queryClient.clear ` ] ( #queryclientclear )
5152
5253** Options**
5354
@@ -471,6 +472,9 @@ The `getQueryDefaults` method returns the default options which have been set fo
471472const defaultOptions = queryClient .getQueryDefaults (' posts' )
472473```
473474
475+ > Note that if several query defaults match the given query key, the ** first** matching one is returned.
476+ > This could lead to unexpected behaviours. See [ ` setquerydefaults ` ] ( #queryclientsetquerydefaults ) .
477+
474478## ` queryClient.setQueryDefaults `
475479
476480` setQueryDefaults ` can be used to set default options for specific queries:
@@ -488,6 +492,9 @@ function Component() {
488492- ` queryKey: QueryKey ` : [ Query Keys] ( ../guides/query-keys )
489493- ` options: QueryOptions `
490494
495+ > As stated in [ ` getquerydefaults ` ] ( #queryclientgetquerydefaults ) , the order of registration of query defaults does matter.
496+ > Since the ** first** matching defaults are returned by ` getquerydefaults ` , the registration should be made in the following order: from the ** least generic key** to the ** most generic one** . This way, in case of specific key, the first matching one would be the expected one.
497+
491498## ` queryClient.getMutationDefaults `
492499
493500The ` getMutationDefaults ` method returns the default options which have been set for specific mutations:
0 commit comments