-
Notifications
You must be signed in to change notification settings - Fork 21
Fix/48 on success context type #57
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/48 on success context type #57
Conversation
react-query rapini-mutations useRapiniMutations body mutationOptions onSuccess param context remove optional
Update test for useRapiniMutation to be ok with onSuccess TContext not beeing optional any more
Added a fix issue under header Unreleased ### Fixed - rametta#48: Make context parameter required in onSuccess callback to match React Query's types
Make issue 48 a clickable link to issue
| undefined, | ||
| ts.factory.createIdentifier("context"), | ||
| ts.factory.createToken(ts.SyntaxKind.QuestionToken), | ||
| undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm :-)
|
Nice, thank you for the PR!
Thanks! |
Revert order back to initial and add fix for issue rametta#48 in bottom as release 3.5.3
|
I first located where in react-query release log this change was made TAG: https://github.com/TanStack/query/releases/tag/v5.14.1 Then I also consulted the AI once more: ConclusionThis change matches React Query's own type changes from this commit. The commit removed optionality from Looking at our test file, we're already expecting this behavior: onSuccess: (data: TData, variables: TVariables, context: TContext) => {
conf?.onSuccess?.(data, variables, context);
onSuccess?.(data, variables, context);
}This change:
Users won't need to provide context explicitly - React Query handles that internally. The type change just ensures we correctly model what React Query guarantees. |
|
@rametta What do you think? Is there something more I should look into? |


Fix #48
As I never seen or worked with code generation before, I took help from ChatGPT Claude 3.5 Sonnnet (Preview) to do this PR. And the suggestions seems legit to me, but... yeah... I think you need to check them 😄

What?
Makes the context parameter required in onSuccess callback to match React Query's types.
This ensures type safety by properly matching React Query's API where context is:
Note that ChatGPT suggested to revert the order of the
changelog.mdfile... so I went with that, can undo that if you want.