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
40.1k stars 2.69k forks source link

feat(angular-query-experimental): support injection in injectQuery callback #7350

Closed ShacharHarshuv closed 2 weeks ago

ShacharHarshuv commented 2 weeks ago

Before, when creating a query with injectQuery, if you injected dependencies (Like inject(HttpClient)) those injections would fail on subsequence changes of dependent signals. That change makes it easier to use injectQuery (especially together with queryOptions because the query can define its own dependencies.

Possible followup: I wonder if we should also wrap queryFn and initialData and placeholderData in an injection context so that it would be possible to inject dependencies in these as well. Right now it will work on the first time but fail (silently, by default) on subsequent fetches.

No breaking changes, any code that worked before should work now as well.

vercel[bot] commented 2 weeks ago

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

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **query** | ⬜️ Ignored ([Inspect](https://vercel.com/tanstack/query/AzLeSMSnWzTwH2HFxuYd7nAdbnNp)) | [Visit Preview](https://query-git-fork-shacharharshuv-angular-query-sup-a11b03-tanstack.vercel.app) | | Apr 30, 2024 10:01pm |
codesandbox-ci[bot] commented 2 weeks ago

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 65781ff0ca0f3aaa7a9fd36ccead7ca98cfe52fd:

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
ShacharHarshuv commented 2 weeks ago

It seems like the styling changes were done automatically on commit by lint-staged. Let me know if you think something in my set up is wrong and it shouldn't have happened.

arnoud-dv commented 2 weeks ago

It seems like the styling changes were done automatically on commit by lint-staged. Let me know if you think something in my set up is wrong and it shouldn't have happened.

Yes that shouldn't happen, there shouldn't be semicolons at the end of lines for example. See prettier.config.js in the root.

ShacharHarshuv commented 2 weeks ago

@arnoud-dv I fixed the prettier issue

nx-cloud[bot] commented 2 weeks ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 65781ff0ca0f3aaa7a9fd36ccead7ca98cfe52fd. 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 - [`nx affected --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build,test:attw --parallel=3`](https://cloud.nx.app/runs/8JU3caLEsp?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.

ShacharHarshuv commented 2 weeks ago

Fix eslint error.

@arnoud-dv Who needs to approve to get this merged?

arnoud-dv commented 2 weeks ago

Fix eslint error.

@arnoud-dv Who needs to approve to get this merged?

I can approve it. Looks good at first glance, will take a more in depth look tomorrow. Thank you!