swagger-typescript icon indicating copy to clipboard operation
swagger-typescript copied to clipboard

support v4 callbacks in v5

Open mohammadgharouni opened this issue 2 years ago • 3 comments

one of the most used features in react query v4 was callbacks (onSuccess, onError, onSettled) I recreated this functions and add the functionality inside getRequest function this feature is easy to implement with promise callbacks

mohammadgharouni avatar Dec 02 '23 11:12 mohammadgharouni

Hello Mohammad,

I hope you're doing well. Now, let me share the history of React-Query. There were numerous misunderstandings among developers regarding certain events, leading the React-Query team to make the decision to remove them. In my view, it would be prudent to align with React-Query's choice and replace the use of onSuccess with useEffect. Introducing those events might inadvertently plunge us into a complex and challenging pool of bugs.

hosseinmd avatar Dec 02 '23 14:12 hosseinmd

following the standards is a good approach and we will try to adopt to it in our project as well however there was a bug with useInfiniteQuery generator where in the options object it requires 3 properties : getNextPageParam, initialPageParam, queryKey

this should be optional since we are generating these properties on the package I would be thankful if you fix that bug or if you want I can make another pull request for this problem (I created a separated type named SwaggerTypescriptUseInfiniteQueryOptions and omitted those properties )

mohammadgharouni avatar Dec 04 '23 10:12 mohammadgharouni

Feel free to open a PR, I will wait to your PR. Thank you.

hosseinmd avatar Dec 11 '23 12:12 hosseinmd