You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+57-4Lines changed: 57 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,63 @@ If you have been assigned to fix an issue or develop a new feature, please follo
52
52
- Git stage your required changes and commit (see below commit guidelines).
53
53
- Submit PR for review.
54
54
55
+
### Editing the docs locally and previewing the changes
56
+
57
+
The documentations forall the TanStack projects are hosted on [tanstack.com](https://tanstack.com), which is a TanStack Start application (https://github.com/TanStack/tanstack.com). You need to run this app locally to preview your changesin the `TanStack/query` docs.
58
+
59
+
> [!NOTE]
60
+
> The website fetches the doc pages from GitHub in production, and searches forthem at `../query/docs`in development. Your local clone of `TanStack/query` needs to be in the same directory as the local clone of `TansStack/tanstack.com`.
61
+
62
+
You can follow these steps to set up the docs forlocal development:
63
+
64
+
1. Make a new directory called `tanstack`.
65
+
66
+
```sh
67
+
mkdir tanstack
68
+
```
69
+
70
+
2. Enter that directory and clone the [`TanStack/query`](https://github.com/TanStack/query) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos.
- Make sure you've installed the dependencies in the repo's root directory.
@@ -72,10 +129,6 @@ If you have been assigned to fix an issue or develop a new feature, please follo
72
129
pnpm run dev
73
130
```
74
131
75
-
#### Note on `examples/react-native`
76
-
77
-
React Native example requires Expo to work. Please follow the instructions from example's README.md file to learn more.
78
-
79
132
#### Note on standalone execution
80
133
81
134
If you want to run an example without installing dependencies for the whole repo, just follow instructions from the example's README.md file. It will be then run against the latest TanStack Query release.
title: Angular HttpClient and other data fetching clients
4
+
---
5
+
6
+
Because TanStack Query's fetching mechanisms are agnostically built on Promises, you can use literally any asynchronous data fetching client, including the browser native `fetch` API, `graphql-request`, and more.
7
+
8
+
## Using Angular's `HttpClient` for data fetching
9
+
10
+
`HttpClient` is a powerful and integrated part of Angular, which gives the following benefits:
11
+
12
+
- Mock responses in unit tests using [provideHttpClientTesting](https://angular.dev/guide/http/testing).
13
+
-[Interceptors](https://angular.dev/guide/http/interceptors) can be used for a wide range of functionality including adding authentication headers, performing logging, etc. While some data fetching libraries have their own interceptor system, `HttpClient` interceptors are integrated with Angular's dependency injection system.
14
+
-`HttpClient` automatically informs [`PendingTasks`](https://angular.dev/api/core/PendingTasks#), which enables Angular to be aware of pending requests. Unit tests and SSR can use the resulting application _stableness_ information to wait for pending requests to finish. This makes unit testing much easier for [Zoneless](https://angular.dev/guide/experimental/zoneless) applications.
15
+
- When using SSR, `HttpClient` will [cache requests](https://angular.dev/guide/ssr#caching-data-when-using-HttpClient) performed on the server. This will prevent unneeded requests on the client. `HttpClient` SSR caching works out of the box. TanStack Query has its own hydration functionality which may be more powerful but requires some setup. Which one fits your needs best depends on your use case.
16
+
17
+
### Using observables in `queryFn`
18
+
19
+
As TanStack Query is a promise based library, observables from `HttpClient` need to be converted to promises. This can be done with the `lastValueFrom` or `firstValueFrom` functions from `rxjs`.
|**Angular HttpClient**| Featureful and very well integrated with Angular. | Observables need to be converted to Promises. |
47
+
|**Fetch**| Browser native API, so adds nothing to bundle size. | Barebones API which lacks many features. |
48
+
|**Specialized libraries such as `graphql-request`**| Specialized features for specific use cases. | If it's not an Angular library it won't integrate well with the framework. |
Copy file name to clipboardExpand all lines: docs/framework/angular/guides/queries.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ replace:
10
10
'custom hooks': 'services',
11
11
'the `useQuery` hook': '`injectQuery`',
12
12
'`useQuery`': '`injectQuery`',
13
+
"TypeScript will also narrow the type of data correctly if you've checked for pending and error before accessing it.": 'TypeScript will only narrow the type when checking boolean signals such as `isPending` and `isError`.',
Copy file name to clipboardExpand all lines: docs/framework/react/community/tkdodos-blog.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ id: tkdodos-blog
3
3
title: TkDodo's Blog
4
4
---
5
5
6
-
TanStack Query maintainer [TkDodo](https://twitter.com/tkdodo) has a series of blog posts about using and working with the library. Some articles show general best practices, but most have an _opinionated_ point of view.
6
+
TanStack Query maintainer [TkDodo](https://bsky.app/profile/tkdodo.eu) has a series of blog posts about using and working with the library. Some articles show general best practices, but most have an _opinionated_ point of view.
0 commit comments