Skip to content

v5.89.0: onError, onSuccess and onSettled signature change breaks existing code #9660

Description

@stefanofa

Describe the bug

After upgrading to @tanstack/react-query v5.89.0, my code using useMutation started failing because the onError callback now expects an extra parameter between variables and context (onMutateResult). This change came from PR #9615.

The same applies for onSuccess and onSettled.

Your minimal, reproducible example

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgVwM4FMCyyYEMbAQB2cAvnAGZQQhwBEAAnkangMYDWA9FOrmzAC0AR2TooATzoBuAFChIsODAlh0iOAFUM2PAWIB5MPpZlK1Wo2at+3XvyGjxUubJVq4u-ISJGTqAB4AEXxcOABeFCIOIggAdyIAGjgANVwoYFwAIwAbdFQIuAA3CGAAEwA+QoMQYBgA2TgtHRxvQ2MfQJC8ZIBRKGooZLSM7LzUCsTG+hBWkwAxIjpZCtd0AA9FeApkIgEfFB0JLxMACggO4lQAfgAuTzmfP06AkvLk1gyiAHMKgEpENNeDBkFASGgsI9iKcENMmrM9D5FvdcKgJHs4KcwOlcCBUADwlVYU0SXBgaCiHJSaQpqSAHQMi7+Wkk4j9QancSDZJFdKZXL5ZJsYgwDYwAHE0lwYAUTFc6B0kD5VC4b7qABk6rgTM61zpbIG0AlcKlOqu+qI7OgnMNQ2KfLGgrgwqIovW4qpUtIJpp01Ifzk3qAA

Steps to reproduce

Previously this compiled: onError(error, variables, context) { /* ... */ }
In v5.89.0 it now must be: onError(error, variables, onMutateResult, context) { /* ... */ }

Expected behavior

Was it expected to ship this as a patch even though it’s breaking? If yes, a doc/changelog note would probably help.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Not relevant

Tanstack Query adapter

None

TanStack Query version

5.89.0

TypeScript version

5.9.2

Additional context

I am creating this issue also to help anyone confused after upgrading.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions