Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(seats): add row lock on allMembers query to prevent race condition

Richie McIlroyf858a5601e21
diff --git a/apps/web/actions/organization/toggle-pro-seat.ts b/apps/web/actions/organization/toggle-pro-seat.ts
index d3c67709e..1b2a12cc7 100644
--- a/apps/web/actions/organization/toggle-pro-seat.ts
+++ b/apps/web/actions/organization/toggle-pro-seat.ts
@@ -65,7 +65,8 @@ export async function toggleProSeat(
hasProSeat: organizationMembers.hasProSeat,
})
.from(organizationMembers)
- .where(eq(organizationMembers.organizationId, organizationId));
+ .where(eq(organizationMembers.organizationId, organizationId))
+ .for("update");
const [owner] = await tx
.select({