"This week at Zumuta!" is a consice reading list about what happened in the Zumuta! universe in the past week.
One of the things I like to do is throwing away code I don't need anymore. Kwai uses Tanstack Query for retrieving and mutating data from the frontend. No need for storing and managing states, Tanstack Query does it for you. Another great thing about this library is that is also available for several JavaScript frameworks. With kwai, Vue is used, at work, I use it with React.
When a mutation is successful, I want to execute some
additional code. When using the useMutation function it is possible to pass a callback to the onSuccess option.
In kwai all the code that is related to Tanstack Query is stored in separate files and I defined an option object to pass
a callback for these functions. Now I found out that it is also possible to pass callbacks when calling the mutate function.
So, all the options for passing onSuccess and other callbacks, can be removed.
Read more about it here.