Skip to content

Commit d2636b8

Browse files
author
Guillaume Labat
committed
doc(QueryClient): fix link to documentation
1 parent 597ff04 commit d2636b8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/src/pages/reference/QueryClient.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ const defaultOptions = queryClient.getQueryDefaults('posts')
473473
```
474474

475475
> 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).
476+
> This could lead to unexpected behaviours. See [`setQueryDefaults`](#queryclientsetquerydefaults).
477477
478478
## `queryClient.setQueryDefaults`
479479

@@ -492,8 +492,8 @@ function Component() {
492492
- `queryKey: QueryKey`: [Query Keys](../guides/query-keys)
493493
- `options: QueryOptions`
494494

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.
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.
497497
498498
## `queryClient.getMutationDefaults`
499499

src/core/queryClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ export class QueryClient {
546546
}
547547
}
548548

549-
findQueryDefaults(
549+
findFirstMatchingQueryDefaults(
550550
queryKey?: QueryKey
551551
): QueryOptions<any, any, any> | undefined {
552552
if (!queryKey) {
@@ -562,7 +562,7 @@ export class QueryClient {
562562
console.warn(
563563
`[QueryClient] Several defaults match with key '${JSON.stringify(
564564
queryKey
565-
)}'. The first matching query options are used. Please check how query defaults are registered. Order does matter here. cf. http://react-query.com/some/link/to/document#queryDefaults.`
565+
)}'. The first matching query defaults are used. Please check how query defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydefaults.`
566566
)
567567
}
568568
// Explicitly returns the first one
@@ -573,7 +573,7 @@ export class QueryClient {
573573
getQueryDefaults(
574574
queryKey?: QueryKey
575575
): QueryObserverOptions<any, any, any, any, any> | undefined {
576-
const queryDefaults = this.findQueryDefaults(queryKey)
576+
const queryDefaults = this.findFirstMatchingQueryDefaults(queryKey)
577577
return queryDefaults
578578
}
579579

0 commit comments

Comments
 (0)