mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-21 21:06:20 +02:00
♻️ Improve query invalidation (#659)
This commit is contained in:
parent
0ad5abb590
commit
5b6d8424af
6 changed files with 21 additions and 26 deletions
|
@ -9,21 +9,6 @@ import { AppRouter } from "../../trpc/routers";
|
|||
export * from "../../trpc/types";
|
||||
|
||||
export const trpc = createTRPCNext<AppRouter>({
|
||||
unstable_overrides: {
|
||||
useMutation: {
|
||||
async onSuccess(opts) {
|
||||
/**
|
||||
* @note that order here matters:
|
||||
* The order here allows route changes in `onSuccess` without
|
||||
* having a flash of content change whilst redirecting.
|
||||
**/
|
||||
await opts.originalFn();
|
||||
if (!opts.meta?.doNotInvalidate) {
|
||||
await opts.queryClient.invalidateQueries();
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
config() {
|
||||
return {
|
||||
links: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue