p6l.richardP

How can I use `onSettled` in the `experimental_createTRPCNextAppDirClient`?

Context

I want to migrate the following trpc/client hook to the experimental version
const searchMandate = api.mandate.search.useMutation({
    onSettled: (data) => {
      searchQueryMethods.reset();
      data?.length
        ? toast.success(`Found ${data?.length} companies.`)
        : toast.message("No companies found.");
    },
  });


However, the experimental_createTRPCNextAppDirClient exposes the mutation directly, not the
useMutation
anymore



Problem
version:
"@trpc/client": "11.0.0-alpha-next-2023-11-01-15-02-16.94"
CleanShot_2023-11-03_at_13.10.212x.png
CleanShot_2023-11-03_at_13.08.462x.png
GitHub
🧙‍♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/trpc
Was this page helpful?