DiamondDragon
DiamondDragon•2w ago

Returning data from Tanstack Query useMutation wrapper

Maybe i'm missing something but is it not possible to return data returned from the convex tanstack query mutation wrapper?
export const createDealMutation = mutation({
args: DealsTable.withoutSystemFields,
handler: async (ctx, args) => {
const dealId = await insertDeal(ctx, args)
return dealId
},
})
export const createDealMutation = mutation({
args: DealsTable.withoutSystemFields,
handler: async (ctx, args) => {
const dealId = await insertDeal(ctx, args)
return dealId
},
})
No description
No description
2 Replies
ballingt
ballingt•2w ago
Is the data not coming through, or is it working but the types are bad?
DiamondDragon
DiamondDragonOP•2w ago
looks like the types just not totally correct. data is unknown here onSuccess: (data) => { console.log('🚀 ~ file: create-deal-form.tsx:35 ~ onSuccess: ~ data:', data) toast.success('Deal created successfully') router.invalidate() },
No description

Did you find this page helpful?