query icon indicating copy to clipboard operation
query copied to clipboard

feat(angular-query): injectQueries

Open Arthie opened this issue 1 year ago β€’ 4 comments

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.

Arthie avatar Sep 02 '24 17:09 Arthie

☁️ 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

Sent with πŸ’Œ from NxCloud.

nx-cloud[bot] avatar Sep 02 '24 17:09 nx-cloud[bot]

Open in Stackblitz

More templates

@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

pkg-pr-new[bot] avatar Sep 02 '24 17:09 pkg-pr-new[bot]

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

@@            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 Coverage Ξ”
@tanstack/angular-query-devtools-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/angular-query-experimental 94.62% <94.44%> (βˆ…)
@tanstack/eslint-plugin-query βˆ… <ΓΈ> (βˆ…)
@tanstack/query-async-storage-persister βˆ… <ΓΈ> (βˆ…)
@tanstack/query-broadcast-client-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/query-codemods βˆ… <ΓΈ> (βˆ…)
@tanstack/query-core βˆ… <ΓΈ> (βˆ…)
@tanstack/query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/query-persist-client-core βˆ… <ΓΈ> (βˆ…)
@tanstack/query-sync-storage-persister βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-next-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/vue-query βˆ… <ΓΈ> (βˆ…)
@tanstack/vue-query-devtools βˆ… <ΓΈ> (βˆ…)
---- 🚨 Try these New Features:

codecov[bot] avatar Sep 02 '24 17:09 codecov[bot]

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

arnoud-dv avatar Sep 02 '24 20:09 arnoud-dv

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!

Timebutt avatar Nov 23 '24 15:11 Timebutt

Thanks for your PR @Arthie.

API wise this PR differs from the other adapters as these have a queries property in their useQueries equivalent options. I'd like to stick to the other adapters as close as possible so users can transfer their knowledge between framework implementations and it makes maintenance easier.

The other functions in the Angular adapter reactive to options such as injectQuery have a single callback function returning the options.

In the result returned from these functions each property is a distinct signal, which helps with fine grained reactivity.

In this PR I think we're almost there in implementing an API consistent with these principles. Feel free to contribute either in code or testing, we maintain a list of what needs to be done in the PR.

arnoud-dv avatar Mar 09 '25 14:03 arnoud-dv