You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: add callback return type tests for mutation callbacks
Adds test coverage for mutation callback return types, inspired by the discussions and [TkDodo's comment](TanStack#9245 (comment)
) in TanStack#9245 and the original Promise.all() edge case identified in TanStack#9202.
The original PR TanStack#9202 narrowed callback return types from `Promise<unknown> | unknown`
to `Promise<void> | void`, but this broke common patterns like:
```ts
onSuccess: (data) => Promise.all([
invalidateQueries(),
trackAnalytics(),
])
```
As noted in [the original discussion](TanStack#9202 (comment)),
this `Promise.all()` pattern was a legitimate use case that many users relied on.
These tests ensure we support all the callback patterns that users expect:
✅ **Sync patterns**: Implicit void, explicit void, non-void returns
✅ **Async patterns**: Async functions, Promise.resolve(), Promise<T> returns
✅ **Promise.all() patterns**: The original breaking case from TanStack#9202
✅ **Promise.allSettled() patterns**: Additional parallel operation support
✅ **Mixed patterns**: Different callback types in same mutation
✅ **Error handling**: All patterns work in error scenarios
✅ **Return value isolation**: Callback returns don't affect mutation result
0 commit comments