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

fix: make sure all options of a query are reactive #7081

Merged
merged 5 commits into from Mar 12, 2024

Conversation

TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Mar 11, 2024

closes #3706

currently, only observer based options are updated between renders (like staleTime), but query level ones are not (like retryDelay). This makes no sense, so trying to streamline here

The deleted test checked for multiple useQuery calls in the tree with different options, which I don't think happens a lot in practice.

As a side-effect, the queryFn is also updated, so it will see values from a closure. This shouldn't matter because everything used in the queryFn must be part of the queryKey

currently, only observer based options are updated between renders (like staleTime), but query level ones are not (like retryDelay). This makes no sense, so trying to streamline here

The deleted test checked for multiple useQuery calls in the tree with different options, which I don't think happens a lot in practice.

As a side-effect, the queryFn is also updated, so it will see values from a closure. This shouldn't matter because everything used in the queryFn must be part of the queryKey
Copy link

vercel bot commented Mar 11, 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 Mar 12, 2024 7:31am

Copy link

nx-cloud bot commented Mar 11, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 29cc288. 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 Mar 11, 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 29cc288:

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

@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2024

Codecov Report

Merging #7081 (29cc288) into main (78ace08) will increase coverage by 0.01%.
Report is 1 commits behind head on main.
The diff coverage is 75.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7081      +/-   ##
==========================================
+ Coverage   41.47%   41.48%   +0.01%     
==========================================
  Files         184      184              
  Lines        7304     7306       +2     
  Branches     1509     1509              
==========================================
+ Hits         3029     3031       +2     
  Misses       3876     3876              
  Partials      399      399              
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 86.46% <ø> (ø)
@tanstack/eslint-plugin-query 85.11% <ø> (ø)
@tanstack/query-async-storage-persister 49.20% <ø> (ø)
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods 0.00% <ø> (ø)
@tanstack/query-core 93.25% <75.00%> (+<0.01%) ⬆️
@tanstack/query-devtools 3.99% <ø> (ø)
@tanstack/query-persist-client-core 57.73% <ø> (ø)
@tanstack/query-sync-storage-persister 82.50% <ø> (ø)
@tanstack/react-query 92.77% <ø> (ø)
@tanstack/react-query-devtools 10.71% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 82.26% <ø> (ø)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query 62.68% <ø> (ø)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (ø)
@tanstack/vue-query 70.81% <ø> (ø)
@tanstack/vue-query-devtools ∅ <ø> (∅)

@TkDodo TkDodo merged commit 605b8e9 into main Mar 12, 2024
6 checks passed
@TkDodo TkDodo deleted the feature/3706-update-query-options branch March 12, 2024 07:37
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.

fetchQuery and useQuery options
2 participants