Implement 100% atomic transaction rollout

Update actions.ts and ApprovalTransactionToggle.tsx to default to the new atomic transaction RPC flow. The feature flag can now be used to disable the new flow for emergency rollback.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-06 20:48:18 +00:00
parent 3be551dc5a
commit 406edc96df
2 changed files with 20 additions and 19 deletions

View File

@@ -178,9 +178,9 @@ export async function approvePhotoSubmission(
* @returns Action result
*/
/**
* Feature flag to enable atomic transaction RPC approval flow.
* Set to true to use the new process-selective-approval-v2 edge function
* that wraps the entire approval in a single PostgreSQL transaction.
* Feature flag: Use new atomic transaction RPC for approvals (v2)
*
* ✅ DEFAULT: NEW atomic transaction flow (100% ROLLOUT)
*
* Benefits of v2:
* - True atomic transactions (all-or-nothing)
@@ -188,11 +188,11 @@ export async function approvePhotoSubmission(
* - Network-resilient (edge function crash = auto rollback)
* - Eliminates orphaned entities
*
* To enable: localStorage.setItem('use_rpc_approval', 'true')
* To disable: localStorage.setItem('use_rpc_approval', 'false')
* To disable NEW flow (emergency rollback): localStorage.setItem('use_rpc_approval', 'false')
* To re-enable NEW flow: localStorage.removeItem('use_rpc_approval')
*/
const USE_RPC_APPROVAL = typeof window !== 'undefined' &&
localStorage.getItem('use_rpc_approval') === 'true';
localStorage.getItem('use_rpc_approval') !== 'false';
export async function approveSubmissionItems(
supabase: SupabaseClient,