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-5538]: Assign observer's current Result when optimistic read occurs #5573

Merged
merged 6 commits into from
Jul 14, 2023

Conversation

incepter
Copy link
Contributor

@incepter incepter commented Jun 13, 2023

fixes #5538

@vercel
Copy link

vercel bot commented Jun 13, 2023

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Jun 23, 2023 2:38pm

@incepter incepter force-pushed the fix-data-double-ref branch from f1187b9 to 125a52a Compare June 13, 2023 14:32
Copy link
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

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

thank you so much 🙌

@nx-cloud
Copy link

nx-cloud bot commented Jun 13, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 2ef9021. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@incepter incepter force-pushed the fix-data-double-ref branch from 0d68f6d to 3702e9b Compare June 13, 2023 17:57
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 13, 2023

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 2ef9021:

Sandbox Source
@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
wandering-sky-pn3h6l Issue #5538
dazzling-https-rrsdgh Issue #5538

@incepter
Copy link
Contributor Author

Here a codesandbox forked from the issue using the version from this PR, I think it solves it

https://codesandbox.io/s/serene-keller-h34qgm?file=/src/App.js

@TkDodo
Copy link
Collaborator

TkDodo commented Jun 17, 2023

I think we can ship this, but could you please also make the same PR to the alpha branch? I think this would be better than to merge main -> alpha and try to address the conflicts there

@codecov-commenter
Copy link

codecov-commenter commented Jun 17, 2023

Codecov Report

Patch coverage: 17.64% and project coverage change: -0.70 ⚠️

Comparison is base (df37d35) 92.19% compared to head (2ef9021) 91.50%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5573      +/-   ##
==========================================
- Coverage   92.19%   91.50%   -0.70%     
==========================================
  Files         112      101      -11     
  Lines        4294     3921     -373     
  Branches     1127      989     -138     
==========================================
- Hits         3959     3588     -371     
+ Misses        314      308       -6     
- Partials       21       25       +4     
Impacted Files Coverage Δ
packages/query-core/src/queryCache.ts 100.00% <ø> (ø)
packages/query-core/src/queryObserver.ts 81.28% <0.00%> (-3.22%) ⬇️
packages/query-core/src/notifyManager.ts 95.12% <100.00%> (+5.12%) ⬆️

... and 11 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@incepter
Copy link
Contributor Author

I think we can ship this, but could you please also make the same PR to the alpha branch? I think this would be better than to merge main -> alpha and try to address the conflicts there

Yes sure, I ported the changes to alpha branch in this PR.

@TkDodo
Copy link
Collaborator

TkDodo commented Jun 23, 2023

there is one test failing now @incepter:

useQuery › should reuse same data object reference when queryKey changes and placeholderData is present

@incepter
Copy link
Contributor Author

there is one test failing now @incepter:

Yes indeed @TkDodo , I fixed it. (I was using the same queryKey and same client for both tests, which resulted in them passing individually, then failing in ci.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why useEffect triggers twice after the API response is cached?
3 participants