Skip to content

Open source personal finance application

fix(convex): add batch size limit to trns.removeBatch mutation

Ilya Komichev4e25512c13e1
diff --git a/convex/trns.ts b/convex/trns.ts
index a84da7d8..6eab10d0 100644
--- a/convex/trns.ts
+++ b/convex/trns.ts
@@ -204,9 +204,14 @@ export const remove = mutation({
},
})
+const BATCH_LIMIT = 500
+
export const removeBatch = mutation({
args: { ids: v.array(v.id('trns')) },
handler: async (ctx, { ids }) => {
+ if (ids.length > BATCH_LIMIT)
+ throw new Error(`Batch size exceeds limit of ${BATCH_LIMIT}`)
+
const user = await requireAuthUser(ctx)
const deletedIds: string[] = []
for (const id of ids) {