Skip to content

Commit 66ab6b5

Browse files
docs(guides): minor fixes and typos (#4419)
* fix: consistent punctuation in list two of these have periods and two don't... so I looked around at what is done elsewhere and took my best guess * adds linkback to docs for refetchOnWindowFocus at this point in the readthrough, this is the very first time I'm seeing anything about "options" and having a link to one is nice, just to quickly see what they look like and hop right back to this page. I'd love to add some docs to the 4 that are mentioned in the next paragraph but they don't seem to have a way to link to them since they're contained in an unordered list on the useQuery page * moves asides to be in context with attached bullets I don't see how to run the docs site locally to test this, but at least on GitHub's markdown parser this would really help align the quote block with the associated bullet (as it is today is sorta hard to follow because some are global and some are attached to bullets, yet they're all at the same level). feel free to drop this commit if it doesn't work for the actual markdown parser. * adds missing inline codeblock for signal obj * matches QueryFunctionContext types to source code see https://github.com/TanStack/query/blob/759aa0a89c593ab452316b799d952153752ac1c9/packages/query-core/src/types.ts#L24 following the standard of https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes these types are subtly incorrect. * fix multiple h1s on page (and this one pushing above) check out https://tanstack.com/query/v4/docs/guides/background-fetching-indicators#displaying-global-background-fetching-loading-state and see that the section that's an h1 at the bottom is pushed pretty hard up against the codeblock before it. I think this is some kind of tailwind problem, but it's a win-win because a page having multiple h1 elements is an accessibility nit anyways
1 parent 759aa0a commit 66ab6b5

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

docs/guides/background-fetching-indicators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function Todos() {
3030
}
3131
```
3232

33-
# Displaying Global Background Fetching Loading State
33+
## Displaying Global Background Fetching Loading State
3434

3535
In addition to individual query loading states, if you would like to show a global loading indicator when **any** queries are fetching (including in the background), you can use the `useIsFetching` hook:
3636

docs/guides/important-defaults.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ Out of the box, React Query is configured with **aggressive but sane** defaults.
1212
- Stale queries are refetched automatically in the background when:
1313
- New instances of the query mount
1414
- The window is refocused
15-
- The network is reconnected.
16-
- The query is optionally configured with a refetch interval.
15+
- The network is reconnected
16+
- The query is optionally configured with a refetch interval
1717

18-
If you see a refetch that you are not expecting, it is likely because you just focused the window and React Query is doing a `refetchOnWindowFocus`. During development, this will probably be triggered more frequently, especially because focusing between the Browser DevTools and your app will also cause a fetch, so be aware of that.
18+
If you see a refetch that you are not expecting, it is likely because you just focused the window and React Query is doing a [`refetchOnWindowFocus`](../guides/window-focus-refetching). During development, this will probably be triggered more frequently, especially because focusing between the Browser DevTools and your app will also cause a fetch, so be aware of that.
1919

2020
> To change this functionality, you can use options like `refetchOnMount`, `refetchOnWindowFocus`, `refetchOnReconnect` and `refetchInterval`.
2121
2222
- Query results that have no more active instances of `useQuery`, `useInfiniteQuery` or query observers are labeled as "inactive" and remain in the cache in case they are used again at a later time.
2323
- By default, "inactive" queries are garbage collected after **5 minutes**.
2424

25-
> To change this, you can alter the default `cacheTime` for queries to something other than `1000 * 60 * 5` milliseconds.
25+
> To change this, you can alter the default `cacheTime` for queries to something other than `1000 * 60 * 5` milliseconds.
2626
2727
- Queries that fail are **silently retried 3 times, with exponential backoff delay** before capturing and displaying an error to the UI.
2828

29-
> To change this, you can alter the default `retry` and `retryDelay` options for queries to something other than `3` and the default exponential backoff function.
29+
> To change this, you can alter the default `retry` and `retryDelay` options for queries to something other than `3` and the default exponential backoff function.
3030
3131
- Query results by default are **structurally shared to detect if data has actually changed** and if not, **the data reference remains unchanged** to better help with value stabilization with regards to useMemo and useCallback. If this concept sounds foreign, then don't worry about it! 99.9% of the time you will not need to disable this and it makes your app more performant at zero cost to you.
3232

33-
> Structural sharing only works with JSON-compatible values, any other value types will always be considered as changed. If you are seeing performance issues because of large responses for example, you can disable this feature with the `config.structuralSharing` flag. If you are dealing with non-JSON compatible values in your query responses and still want to detect if data has changed or not, you can define a data compare function with `config.isDataEqual` or provide your own custom function as `config.structuralSharing` to compute a value from the old and new responses, retaining references as required.
33+
> Structural sharing only works with JSON-compatible values, any other value types will always be considered as changed. If you are seeing performance issues because of large responses for example, you can disable this feature with the `config.structuralSharing` flag. If you are dealing with non-JSON compatible values in your query responses and still want to detect if data has changed or not, you can define a data compare function with `config.isDataEqual` or provide your own custom function as `config.structuralSharing` to compute a value from the old and new responses, retaining references as required.
3434
3535
## Further Reading
3636

docs/guides/query-functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ function fetchTodoList({ queryKey }) {
6666
The `QueryFunctionContext` is the object passed to each query function. It consists of:
6767

6868
- `queryKey: QueryKey`: [Query Keys](../guides/query-keys)
69-
- `pageParam: unknown | undefined`
69+
- `pageParam?: unknown`
7070
- only for [Infinite Queries](../guides/infinite-queries)
7171
- the page parameter used to fetch the current page
72-
- signal?: AbortSignal
72+
- `signal?: AbortSignal`
7373
- [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) instance provided by react-query
7474
- Can be used for [Query Cancellation](../guides/query-cancellation)
75-
- `meta?: Record<string, unknown>`
75+
- `meta: Record<string, unknown> | undefined`
7676
- an optional field you can fill with additional information about your query
7777

7878
## Using a Query Object instead of parameters

0 commit comments

Comments
 (0)