TanStack / query

πŸ€– Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
https://tanstack.com/query
MIT License
42.77k stars 2.93k forks source link

feat(angular-query): injectQueries #8007

Open Arthie opened 3 months ago

Arthie commented 3 months ago

Noticed injectQueries had yet to be fully implemented, this is my attempt to get it working. Did some limited testing, and added simple test cases that are all passing.

Looking for feedback.

nx-cloud[bot] commented 3 months ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b7315dc6a0110831353855f612eee5974e279d3c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

πŸ“‚ See all runs for this CI Pipeline Execution


βœ… Successfully ran 2 targets - [`nx affected --targets=test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build --parallel=3`](https://cloud.nx.app/runs/ztsse3d6l8?utm_source=pull-request&utm_medium=comment) - [`nx run-many --target=build --exclude=examples/** --exclude=integrations/**`](https://cloud.nx.app/runs/Qd7KXQP4Sp?utm_source=pull-request&utm_medium=comment)

Sent with πŸ’Œ from NxCloud.

pkg-pr-new[bot] commented 3 months ago

Open in Stackblitz

More templates

- [@tanstack/query-example-angular-basic](https://pkg.pr.new/template/f5b9ae42-c0ed-47f8-84ff-afac32edbda7) - [@tanstack/query-example-angular-devtools-panel](https://pkg.pr.new/template/2af9b622-fbeb-4730-bad5-f42ad7c0e158) - [@tanstack/query-example-angular-pagination](https://pkg.pr.new/template/4356ed9c-65b3-41fc-a19e-e898d2de2b59) - [@tanstack/query-example-angular-infinite-query-with-max-pages](https://pkg.pr.new/template/2fdfa9e0-42aa-4834-baae-e5d7894b62b1) - [@tanstack/query-example-angular-query-options-from-a-service](https://pkg.pr.new/template/63d74805-4049-4a96-937c-50daab377420) - [@tanstack/query-example-angular-router](https://pkg.pr.new/template/76c60c30-c49a-4ae3-9f51-82ae262248f0) - [@tanstack/query-example-angular-rxjs](https://pkg.pr.new/template/6dd17046-af94-4766-bf29-1c3ec3920857) - [@tanstack/query-example-angular-simple](https://pkg.pr.new/template/57ea7361-0b8f-40df-8983-94b2e516ab84) - [@tanstack/query-example-react-algolia](https://pkg.pr.new/template/2610a251-54d7-4d95-ae82-8d869fe4cce3) - [@tanstack/query-example-react-auto-refetching](https://pkg.pr.new/template/87e0db42-9622-49d4-8f36-9cafcd2607e3) - [@tanstack/query-example-react-basic](https://pkg.pr.new/template/5591ccc3-c461-4121-ab62-9d2c2c76e856) - [@tanstack/query-example-react-basic-graphql-request](https://pkg.pr.new/template/e71e9223-39ce-4488-9574-4f6beb966e4c) - [@tanstack/query-example-react-default-query-function](https://pkg.pr.new/template/31ff2dbb-acaa-4716-967b-ed2032e3b7ed) - [@tanstack/query-example-react-devtools-panel](https://pkg.pr.new/template/20658357-ccda-42ee-89af-bc4b04773335) - [@tanstack/query-example-react-infinite-query-with-max-pages](https://pkg.pr.new/template/7c0be90d-d651-4bf1-a90c-aaa700ca9a75) - [@tanstack/query-example-react-load-more-infinite-scroll](https://pkg.pr.new/template/8035fa1b-24a1-4793-8093-f4addaf12e64) - [@tanstack/query-example-react-nextjs](https://pkg.pr.new/template/4f1775a5-f61a-4772-9a66-9ce817bf73fd) - [@tanstack/query-example-react-nextjs-app-prefetching](https://pkg.pr.new/template/5ea54604-ad74-4763-9a37-a079daea320b) - [@tanstack/query-example-nextjs-suspense-streaming](https://pkg.pr.new/template/19713d30-caff-4b22-9260-a624c963da33) - [@tanstack/query-example-react-optimistic-updates-cache](https://pkg.pr.new/template/c871bf5d-39b7-49d7-803a-d57a459fe0ea) - [@tanstack/query-example-react-offline](https://pkg.pr.new/template/00759e0b-a9da-4f35-b379-66a9fd169b0a) - [@tanstack/query-example-react-optimistic-updates-ui](https://pkg.pr.new/template/a1b7bda3-1e18-42cf-b28a-b2dc035fbc33) - [@tanstack/query-example-react-pagination](https://pkg.pr.new/template/3f29ce26-4ce2-4d87-8b6b-92a0e19715db) - [@tanstack/query-example-react-playground](https://pkg.pr.new/template/89be8210-ead3-40d0-8a70-e49c09fa256a) - [@tanstack/query-example-react-prefetching](https://pkg.pr.new/template/0791a322-7f78-4ba5-beb2-9c38db8f6a59) - [@tanstack/query-example-react-react-native](https://pkg.pr.new/template/be760f4b-aff3-405e-86e2-dea42cd43e30) - [@tanstack/query-example-react-router](https://pkg.pr.new/template/76264b61-787f-424a-9851-58a9c4776730) - [@tanstack/query-example-react-rick-morty](https://pkg.pr.new/template/db5cba7a-b58d-4548-8dd9-0f6a7e859366) - [@tanstack/query-example-react-shadow-dom](https://pkg.pr.new/template/59600bcd-07c9-4bfe-a724-042d4a5c919b) - [@tanstack/query-example-react-simple](https://pkg.pr.new/template/03643222-e011-4ffd-8bbd-7ee5f246a758) - [@tanstack/query-example-react-star-wars](https://pkg.pr.new/template/85831fe9-590d-48d3-9dfc-d2bc3614803b) - [@tanstack/query-example-react-suspense](https://pkg.pr.new/template/75ae6fd0-d707-4b0d-8380-04aa7902bd5c) - [@tanstack/query-example-solid-astro](https://pkg.pr.new/template/b0ebef64-af17-4b01-9017-b10364ace24a) - [@tanstack/query-example-solid-basic](https://pkg.pr.new/template/dc0c72e4-e198-4798-b247-5db5a2123142) - [@tanstack/query-example-solid-basic-graphql-request](https://pkg.pr.new/template/c4c9e918-3b0b-4656-a6dd-8ad869c3502b) - [@tanstack/query-example-solid-default-query-function](https://pkg.pr.new/template/8b7f810a-9712-4568-8666-154362852d6a) - [@tanstack/query-example-solid-simple](https://pkg.pr.new/template/accfab7b-4606-4593-b363-b7574da74b49) - [@tanstack/query-example-solid-start-streaming](https://pkg.pr.new/template/1efdc698-1823-4197-afec-8f1c364365b4) - [@tanstack/query-example-vue-2.6-basic](https://pkg.pr.new/template/121fbb71-ed8f-4156-82c9-a387b53840d3) - [@tanstack/query-example-vue-2.7-basic](https://pkg.pr.new/template/f4f34707-0497-44f1-ad33-85d0004a1f07) - [@tanstack/query-example-vue-basic](https://pkg.pr.new/template/224c8d37-b9f0-49ca-bda2-a114ca6617a2) - [@tanstack/query-example-vue-dependent-queries](https://pkg.pr.new/template/564fb995-4475-40e7-a871-1616d4a0c93b) - [@tanstack/query-example-vue-nuxt3](https://pkg.pr.new/template/aa9202a3-a83f-49e7-89f2-beabf5607a0b) - [@tanstack/query-example-vue-persister](https://pkg.pr.new/template/ba7a3539-02ae-4830-88f5-c83c82b030e3) - [@tanstack/query-example-vue-simple](https://pkg.pr.new/template/59126810-8e16-4ab0-a17d-f0e184c50161) - [@tanstack/query-example-svelte-auto-refetching](https://pkg.pr.new/template/0750cd81-193d-45ce-b254-f6bd6d5c465b) - [@tanstack/query-example-svelte-basic](https://pkg.pr.new/template/cdd7b08a-baac-4d49-834a-70a16e833945) - [@tanstack/query-example-svelte-load-more-infinite-scroll](https://pkg.pr.new/template/a08cc0d2-357c-4dad-949d-78fc8e71c512) - [@tanstack/query-example-svelte-optimistic-updates](https://pkg.pr.new/template/a2e9237a-d53d-45ab-9f8d-44eb456b2faf) - [@tanstack/query-example-svelte-playground](https://pkg.pr.new/template/767048a4-866f-43d0-b615-78b9746f3fe6) - [@tanstack/query-example-svelte-ssr](https://pkg.pr.new/template/75c08d03-28a3-46b5-82f8-53e35c9e5bc4) - [@tanstack/query-example-svelte-simple](https://pkg.pr.new/template/5b91adf3-9083-41a2-9e0b-5e9b0fe3bd3a) - [@tanstack/query-example-svelte-star-wars](https://pkg.pr.new/template/fbcc45c9-fab9-44d4-b0c9-371180a217b1)

@tanstack/angular-query-devtools-experimental

``` pnpm add https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@8007 ```

@tanstack/query-async-storage-persister

``` pnpm add https://pkg.pr.new/@tanstack/query-async-storage-persister@8007 ```

@tanstack/query-broadcast-client-experimental

``` pnpm add https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@8007 ```

@tanstack/eslint-plugin-query

``` pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-query@8007 ```

@tanstack/query-core

``` pnpm add https://pkg.pr.new/@tanstack/query-core@8007 ```

@tanstack/angular-query-experimental

``` pnpm add https://pkg.pr.new/@tanstack/angular-query-experimental@8007 ```

@tanstack/query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/query-devtools@8007 ```

@tanstack/query-persist-client-core

``` pnpm add https://pkg.pr.new/@tanstack/query-persist-client-core@8007 ```

@tanstack/query-sync-storage-persister

``` pnpm add https://pkg.pr.new/@tanstack/query-sync-storage-persister@8007 ```

@tanstack/react-query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/react-query-devtools@8007 ```

@tanstack/react-query

``` pnpm add https://pkg.pr.new/@tanstack/react-query@8007 ```

@tanstack/react-query-next-experimental

``` pnpm add https://pkg.pr.new/@tanstack/react-query-next-experimental@8007 ```

@tanstack/react-query-persist-client

``` pnpm add https://pkg.pr.new/@tanstack/react-query-persist-client@8007 ```

@tanstack/solid-query

``` pnpm add https://pkg.pr.new/@tanstack/solid-query@8007 ```

@tanstack/solid-query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/solid-query-devtools@8007 ```

@tanstack/solid-query-persist-client

``` pnpm add https://pkg.pr.new/@tanstack/solid-query-persist-client@8007 ```

@tanstack/svelte-query

``` pnpm add https://pkg.pr.new/@tanstack/svelte-query@8007 ```

@tanstack/svelte-query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/svelte-query-devtools@8007 ```

@tanstack/svelte-query-persist-client

``` pnpm add https://pkg.pr.new/@tanstack/svelte-query-persist-client@8007 ```

@tanstack/vue-query

``` pnpm add https://pkg.pr.new/@tanstack/vue-query@8007 ```

@tanstack/vue-query-devtools

``` pnpm add https://pkg.pr.new/@tanstack/vue-query-devtools@8007 ```

commit: b7315dc

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.

Project coverage is 94.62%. Comparing base (102b6a8) to head (b7315dc).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/TanStack/query/pull/8007/graphs/tree.svg?width=650&height=150&src=pr&token=jqEbswkEDQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack)](https://app.codecov.io/gh/TanStack/query/pull/8007?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) ```diff @@ Coverage Diff @@ ## main #8007 +/- ## ========================================= + Coverage 0 94.62% +94.62% ========================================= Files 0 18 +18 Lines 0 279 +279 Branches 0 41 +41 ========================================= + Hits 0 264 +264 - Misses 0 14 +14 - Partials 0 1 +1 ``` | [Components](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | Coverage Ξ” | | |---|---|---| | [@tanstack/angular-query-devtools-experimental](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/angular-query-experimental](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `94.62% <94.44%> (βˆ…)` | | | [@tanstack/eslint-plugin-query](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/query-async-storage-persister](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/query-broadcast-client-experimental](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/query-codemods](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/query-core](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/query-devtools](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/query-persist-client-core](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/query-sync-storage-persister](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/react-query](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/react-query-devtools](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/react-query-next-experimental](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/react-query-persist-client](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/solid-query](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/solid-query-devtools](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/solid-query-persist-client](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/svelte-query](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/svelte-query-devtools](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/svelte-query-persist-client](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/vue-query](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/vue-query-devtools](https://app.codecov.io/gh/TanStack/query/pull/8007/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | |

🚨 Try these New Features:

arnoud-dv commented 3 months ago

That's great, finishing injectQueries is one of the major pieces of work remaining. I'll review it but may be a few days.

Timebutt commented 1 week ago

I just pulled this branch into my project since I needed the injectQueries functionality, and found it non-functional in the current implementation in main. Is this something we can get reviewed so that it could make its way into the main branch? Thanks!