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.75k stars 2.92k forks source link

fix: Allow optional initialData object in queryOptions #8162

Closed sungpaks closed 1 month ago

sungpaks commented 1 month ago

Similar with #8157 Allowed optional initialData, not only a function but also an object, in queryOptions And one more very small change, removed an unnecessary line.

nx-cloud[bot] commented 1 month ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 3800783ca01667366aa35123bc83d52fd6b24a03. 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/VE8cubAshb?utm_source=pull-request&utm_medium=comment) - [`nx run-many --target=build --exclude=examples/** --exclude=integrations/**`](https://cloud.nx.app/runs/ITvOU8oY6o?utm_source=pull-request&utm_medium=comment)

Sent with πŸ’Œ from NxCloud.

pkg-pr-new[bot] commented 1 month ago

Open in Stackblitz

More templates

- [@tanstack/query-example-angular-basic](https://pkg.pr.new/template/7d20d7d5-4c73-42f3-a07b-5f52b6040c3c) - [@tanstack/query-example-angular-infinite-query-with-max-pages](https://pkg.pr.new/template/44ec015e-e8d9-4e4c-832a-1bee675d42f5) - [@tanstack/query-example-angular-pagination](https://pkg.pr.new/template/5896673b-f97f-4dcb-8571-40ca27f61e04) - [@tanstack/query-example-angular-rxjs](https://pkg.pr.new/template/6ec25db6-c6c5-4fc5-ac49-7c58e91f38e9) - [@tanstack/query-example-angular-router](https://pkg.pr.new/template/75c75afd-3e2b-4bf0-9013-92f8d93d6886) - [@tanstack/query-example-angular-simple](https://pkg.pr.new/template/d70fb237-7e8e-4de9-b25d-1bea73bc9c3a) - [@tanstack/query-example-solid-astro](https://pkg.pr.new/template/44fe67c0-fdd7-4d31-b898-ab75c7502352) - [@tanstack/query-example-solid-basic](https://pkg.pr.new/template/b82ea21e-8ff5-4e48-9c84-ca6d0cc97f39) - [@tanstack/query-example-solid-basic-graphql-request](https://pkg.pr.new/template/3ce71089-7d34-4bad-8dd9-b4c7eef8fe78) - [@tanstack/query-example-solid-default-query-function](https://pkg.pr.new/template/cd881d4c-e345-4f80-aef3-550c77dde083) - [@tanstack/query-example-solid-simple](https://pkg.pr.new/template/91a84701-a56c-4051-b0da-248c073838ca) - [@tanstack/query-example-solid-start-streaming](https://pkg.pr.new/template/57a29579-f531-43a9-8ee2-11e938984225) - [@tanstack/query-example-svelte-auto-refetching](https://pkg.pr.new/template/5cff484e-f3eb-4b5e-b1ee-9cf43c210b88) - [@tanstack/query-example-svelte-basic](https://pkg.pr.new/template/fa73952d-cbba-4f9a-acb3-ea5448356544) - [@tanstack/query-example-svelte-load-more-infinite-scroll](https://pkg.pr.new/template/e07e7a07-4f5a-4dae-9aab-1608887bcb44) - [@tanstack/query-example-svelte-optimistic-updates](https://pkg.pr.new/template/24b21f42-f041-41fa-817c-79bedd63b85e) - [@tanstack/query-example-svelte-playground](https://pkg.pr.new/template/78ae783b-844c-49c9-8640-7d7578fa066d) - [@tanstack/query-example-svelte-simple](https://pkg.pr.new/template/d1169c87-c3a0-448f-9366-9198bb95ec9c) - [@tanstack/query-example-svelte-ssr](https://pkg.pr.new/template/a4ed1c91-ff9e-44bd-b86f-8b2c69ca3443) - [@tanstack/query-example-svelte-star-wars](https://pkg.pr.new/template/41c0533f-7bc9-4937-ac91-87c9d7165d0a) - [@tanstack/query-example-react-algolia](https://pkg.pr.new/template/c4f8cf0e-b366-49be-af7d-43ff69182d81) - [@tanstack/query-example-react-auto-refetching](https://pkg.pr.new/template/8b81b8f7-a778-4d2e-b1a6-f1450e71d187) - [@tanstack/query-example-react-basic](https://pkg.pr.new/template/bb88f6cc-4660-43b4-9060-c60cefc217ef) - [@tanstack/query-example-react-basic-graphql-request](https://pkg.pr.new/template/ed9b13dc-bb65-48ba-a314-ba3401162aab) - [@tanstack/query-example-react-default-query-function](https://pkg.pr.new/template/391ade6d-9dbb-4f81-af15-a0718c964bfa) - [@tanstack/query-example-react-devtools-panel](https://pkg.pr.new/template/ca2113b5-f88e-49fa-8374-aaa328a7cbdc) - [@tanstack/query-example-react-infinite-query-with-max-pages](https://pkg.pr.new/template/4d116aaa-3cc1-4ed7-a1c5-a605fcbeaab7) - [@tanstack/query-example-react-load-more-infinite-scroll](https://pkg.pr.new/template/d2737da0-38e0-4ee3-8e58-ebbe073b3abf) - [@tanstack/query-example-react-nextjs](https://pkg.pr.new/template/5b9d9465-bc46-4779-95c4-025ec236986e) - [@tanstack/query-example-react-nextjs-app-prefetching](https://pkg.pr.new/template/534a11e9-1a3c-4782-a423-d8f7766595ef) - [@tanstack/query-example-nextjs-suspense-streaming](https://pkg.pr.new/template/2cd98092-cf8a-4caa-936a-32ea1e126b6c) - [@tanstack/query-example-react-offline](https://pkg.pr.new/template/18861bb9-43de-40de-b336-f88f5b68b5d6) - [@tanstack/query-example-react-optimistic-updates-cache](https://pkg.pr.new/template/0a6ca3bb-7790-4163-b972-0f8361537c5e) - [@tanstack/query-example-react-optimistic-updates-ui](https://pkg.pr.new/template/5c53ec01-3125-4657-94db-dc630f107427) - [@tanstack/query-example-react-pagination](https://pkg.pr.new/template/997d8bc8-d79c-4b83-8fbf-92a84837a134) - [@tanstack/query-example-react-playground](https://pkg.pr.new/template/dcdb55df-bc16-48cf-ba8a-4209532c8905) - [@tanstack/query-example-react-prefetching](https://pkg.pr.new/template/4c8739fb-e317-451a-b0c3-f54a0bf38498) - [@tanstack/query-example-react-router](https://pkg.pr.new/template/ec352e9a-a8c8-4930-b2e5-fcf58269faa0) - [@tanstack/query-example-react-react-native](https://pkg.pr.new/template/a9ae8576-130a-4f12-bf1b-a6c689784e72) - [@tanstack/query-example-react-rick-morty](https://pkg.pr.new/template/36801e70-e753-46ea-b902-12c8a0ba9eaf) - [@tanstack/query-example-react-shadow-dom](https://pkg.pr.new/template/85661b3c-861a-4e5d-a2bc-9f78f518ee0e) - [@tanstack/query-example-react-simple](https://pkg.pr.new/template/2ee2612f-3430-49fb-9243-dffc9d5ebfef) - [@tanstack/query-example-react-star-wars](https://pkg.pr.new/template/7bdc1564-9b25-40b8-be0d-468d08294489) - [@tanstack/query-example-vue-2.6-basic](https://pkg.pr.new/template/cf4d4145-b1e8-4d74-8d3f-6057615e8515) - [@tanstack/query-example-react-suspense](https://pkg.pr.new/template/e30c2586-a496-4822-a354-09575afa8f06) - [@tanstack/query-example-vue-2.7-basic](https://pkg.pr.new/template/1ac2be89-9c66-4f95-a030-c564557c7a6d) - [@tanstack/query-example-vue-dependent-queries](https://pkg.pr.new/template/eeab7607-97a8-4e14-ba93-d95b4cad7c18) - [@tanstack/query-example-vue-basic](https://pkg.pr.new/template/089de034-49f3-49fc-ab9e-d3f5af37fcda) - [@tanstack/query-example-vue-nuxt3](https://pkg.pr.new/template/eaf0b776-ea09-48c9-bd58-fdffd8337464) - [@tanstack/query-example-vue-persister](https://pkg.pr.new/template/4b6a8f36-1166-4732-bb68-cd285a215f7c) - [@tanstack/query-example-vue-simple](https://pkg.pr.new/template/a7dbdb4a-be32-4e82-88dc-15274e7274bb)

@tanstack/angular-query-devtools-experimental

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

@tanstack/query-async-storage-persister

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

@tanstack/eslint-plugin-query

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/solid-query

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query-devtools

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

@tanstack/vue-query

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

@tanstack/angular-query-experimental

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

commit: 3800783

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.89%. Comparing base (e3aca98) to head (3800783). Report is 3 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/TanStack/query/pull/8162/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/8162?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) ```diff @@ Coverage Diff @@ ## main #8162 +/- ## ========================================= + Coverage 0 81.89% +81.89% ========================================= Files 0 26 +26 Lines 0 359 +359 Branches 0 99 +99 ========================================= + Hits 0 294 +294 - Misses 0 56 +56 - Partials 0 9 +9 ``` | [Components](https://app.codecov.io/gh/TanStack/query/pull/8162/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/8162/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/8162/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | | | [@tanstack/eslint-plugin-query](https://app.codecov.io/gh/TanStack/query/pull/8162/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/8162/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/8162/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/8162/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/8162/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/8162/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/8162/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/8162/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/8162/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `93.12% <ΓΈ> (βˆ…)` | | | [@tanstack/react-query-devtools](https://app.codecov.io/gh/TanStack/query/pull/8162/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `10.00% <ΓΈ> (βˆ…)` | | | [@tanstack/react-query-next-experimental](https://app.codecov.io/gh/TanStack/query/pull/8162/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/8162/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `100.00% <ΓΈ> (βˆ…)` | | | [@tanstack/solid-query](https://app.codecov.io/gh/TanStack/query/pull/8162/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/8162/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/8162/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/8162/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/8162/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/8162/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/8162/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/8162/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TanStack) | `βˆ… <ΓΈ> (βˆ…)` | |