T
TanStack17mo ago
deep-jade

best practices for mutation side effects

i want to implement a popup to show "workorder id X created" when a mutation completes. I can do this in onSuccess. I also have a popup before that says the workorder is being created which im thinking can go into onMutate, and I since i want these popups to show every time the mutation runs I was wondering if it makes sense to put them in in these functions or if it is better to separate things more from a best practices perspective?
1 Reply
flat-fuchsia
flat-fuchsia16mo ago
sounds good there are also toast libraries that can take a promise and show a spinner until it's resolved, which works well with mutateAsync

Did you find this page helpful?