Skip to content
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

refactor(angular-query): align inject-query and inject-infinite-query implementations, refactor create-base-query #7593

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

Arthie
Copy link
Contributor

@Arthie Arthie commented Jun 19, 2024

The company I work for is moving from our custom query wrapper to the official one. I had some time to audit the code and refactored a bit.

Aligned the injectQuery and injectInfiniteQuery implementations. These are simpler now and refactored the queryclient to createBaseQuery closer to where it's actually used. This can be changed again once there is a new API to provide a custom queryClient to injectQuery.

Had some time left to add types tests to the injectQuery tests.
Hope this is useful and that I get some more time in the future to contribute more.

Test are passing, and I've tested these changes in the examples and our company app.

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview Jun 20, 2024 9:31am

Copy link

nx-cloud bot commented Jun 19, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit f748ee4. 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 1 target

Sent with 💌 from NxCloud.

Copy link

codesandbox-ci bot commented Jun 19, 2024

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 f748ee4:

Sandbox Source
@tanstack/query-example-angular-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-svelte-basic Configuration
@tanstack/query-example-vue-basic Configuration

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.52%. Comparing base (bda8a54) to head (f748ee4).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           main    #7593       +/-   ##
=========================================
+ Coverage      0   86.52%   +86.52%     
=========================================
  Files         0       18       +18     
  Lines         0      230      +230     
  Branches      0       34       +34     
=========================================
+ Hits          0      199      +199     
- Misses        0       31       +31     
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 86.52% <100.00%> (∅)
@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 ∅ <ø> (∅)

@Arthie Arthie changed the title refactor(angular-query): align inject-query and inject-infinite-query implementations, clean-up create-base-query refactor(angular-query): align inject-query and inject-infinite-query implementations, refactor create-base-query Jun 20, 2024
@Arthie Arthie force-pushed the refactor-angular-query branch from 7305a71 to 6a89739 Compare June 20, 2024 09:24
})
})

test('should return the correct types', () => {
Copy link
Contributor Author

@Arthie Arthie Jun 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are Angular's version of the correct types test for react-query:
https://github.com/TanStack/query/blob/main/packages/react-query/src/__tests__/useQuery.test.tsx

Let me know if you want these moved to inject-query.test-d.ts. Put them here for location consistency with other adapter tests

… + clean-up create-base-query + add query correct type tests
@Arthie Arthie force-pushed the refactor-angular-query branch from 6a89739 to f748ee4 Compare June 20, 2024 09:31
@arnoud-dv arnoud-dv merged commit b7aaa03 into TanStack:main Jun 21, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants