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(core): make sure batching finishes if exception is thrown #3216

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Jan 20, 2022

incrementing and decrementing transactions need to happen in an atomic operation, no matter what happens in between; if we increment, but never decrement, we will get to a state where transactions can never become zero - we're basically "leaking" an open transaction. This leads to no observers being informed ever again because we think we still have an open transaction

this can be fixed by using try/finally to always decrement the transactions

closes #3215

incrementing and decrementing transactions need to happen in an atomic operation, no matter what happens in between; if we increment, but never decrement, we will get to a state where transactions can never become zero - we're basically "leaking" an open transaction. This leads to no observers being informed ever again because we think we still have an open transaction

this can be fixed by using try/finally to always decrement the transactions
@vercel
Copy link

vercel bot commented Jan 20, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tanstack/react-query/D7v1xqZerUpWfXeSvEcMVHYam8jh
✅ Preview: https://react-query-git-fork-tkdodo-feature-3215-tanstack.vercel.app

@codesandbox-ci
Copy link

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 0ac3b4f:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query Configuration
magical-architecture-6z7wx Issue #3215

@codecov
Copy link

codecov bot commented Jan 20, 2022

Codecov Report

Merging #3216 (0ac3b4f) into master (e328ca0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3216   +/-   ##
=======================================
  Coverage   96.47%   96.47%           
=======================================
  Files          45       45           
  Lines        2270     2271    +1     
  Branches      639      639           
=======================================
+ Hits         2190     2191    +1     
  Misses         77       77           
  Partials        3        3           
Impacted Files Coverage Δ
src/core/notifyManager.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e328ca0...0ac3b4f. Read the comment docs.

@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 3.34.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

@TkDodo TkDodo deleted the feature/3215 branch January 21, 2022 12:35
@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 4.0.0-alpha.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

NotifyManager breaks when a exception occurs in onSuccess callback
2 participants