Skip to content

Commit

Permalink
Invalidate table list query on create new table
Browse files Browse the repository at this point in the history
  • Loading branch information
solomonhawk committed Oct 27, 2024
1 parent 5346c4f commit 7dad1e5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export function TableCreateForm({
}: {
onCreate?: (table: TableModel) => void;
}) {
const trpcUtils = trpc.useUtils();

const form = useZodForm({
schema: tableCreateInput,
defaultValues: {
Expand All @@ -35,6 +37,9 @@ export function TableCreateForm({
const createTableMutation = trpc.table.create.useMutation({
onSuccess: async (data) => {
toastSuccess("Table created");

trpcUtils.table.list.invalidate();

await onCreate?.(data);
},
onError: (e) => {
Expand Down

0 comments on commit 7dad1e5

Please sign in to comment.