Cursor Plugin Convex Rule Async Handling

Always await promises in Convex functions to prevent unexpected behavior

KunanonJ Updated 5 repo stars

File contents

Async Handling in Convex

Always await all promises in Convex functions. Not awaiting promises (e.g., await ctx.scheduler.runAfter, await ctx.db.patch, await ctx.db.insert) may cause unexpected behavior.

Examples

Bad:

export const updateUser = mutation({
  handler: async (ctx, args) => {
    ctx.db.patch(args.userId, { name: args.name }); // Missing await
  }
});

Good:

export const updateUser = mutation({
  handler: async (ctx, args) => {
    await ctx.db.patch(args.userId, { name: args.name });
  }
});

Enable the no-floating-promises ESLint rule to catch these errors.

KunanonJ/ai-skills-hub commit 76a9ca696a

Frequently asked questions

npx get-skill add kunanonj/cursor-plugin-convex-rule-async-handling