fix(query-core): query cancellation and reverting (#9293)
* fix: we don't want errors that get reverted internally to throw on imperative methods to achieve that, we let the retryer's `onError` "transform" the result back to potentially TData, and if so, we'll resolve the promise to that instead; that means calls to `fetchQuery` will be "successful" when a cancellation happens in the meantime, but they will then resolve to the reverted data; also, if the initial fetch is cancelled, we would still throw, as there is no data to revert to. * refactor: async/await * minimal test adjustments * test: fix it * fix: revertState is now a local variable * fix: make sure "silent" reverts do not reject ongoing promises up until now, silent reverts have only stopped the query from going into error state, but the exposed promise was still rejected now, the promise won't reject because a silent revert indicates another refetch happening, so we'd want to get that promise's result instead this also means "silent" is an internal thing that shouldn't be used by consumers, because it can lead to never resolving promises instead * chore: bring back isCancelledError and deprecate it * test: revert changes * test: minimal adjustment to timings
D
Dominik Dorfmeister committed
099157678173f875745d208e4806d1fa7b3367b5
Parent: 31f51b9
Committed by GitHub <noreply@github.com>
on 8/14/2025, 8:49:58 AM