-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
angular-query: Update quick-start.md #6775
Conversation
Some minor fixes to update the quick start example to a version which would actually compile
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
@@ -12,8 +12,10 @@ If you're looking for a fully functioning example, please have a look at our [ba | |||
### Provide the client to your App | |||
|
|||
```ts | |||
import {provideHttpClient} from '@angular/common/http'; | |||
import {provideAngularQuery} from '@tanstack/angular-query-experimental' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QUestion: where to import QueryClient
from? it is not exported by @tanstack/angular-query-experimental.
Is @tanstack/query-core
required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can import it from the angular package, since it re-exports everything from query-core. See here: https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/index.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Then it is just a stackblitz issue i was tricked by. When using the package in stackblitz it is not able to import QueryCLient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be wrong, @arnoud-dv could you confirm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're correct Lachlan. Importing QueryClient from @tanstack/angular-query-experimental
is how it's intended to be used.
@mikelgo See packages/angular-query-experimental/src/index.ts
, everything is re-exported from core. There is no need to install or import from @tanstack/query-core
separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned it is just a stackblitz issue, see https://stackblitz.com/edit/stackblitz-starters-xiui1d?file=src%2Fmain.ts
In the "real world" all is fine. will also update the pr to reflect the import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikelgo That Stackblitz has an extremely old TypeScript version which Angular itself is not compatible with, and also contains tslint which has been deprecated for many years. It appears this is based on a very outdated template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arnoud-dv Idk to be honest but that might be the reason. I just created it this morning with the current Angular template.
But anyways - it's not an issue you guys need to worry about :) But thanks for pointing that out :)
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3969299:
|
Some minor fixes to update the quick start example to a version which would actually compile