Home / Function/ resolveDeleteRowConflicts() — supabase Function Reference

resolveDeleteRowConflicts() — supabase Function Reference

Architecture documentation for the resolveDeleteRowConflicts() function in queueConflictResolution.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  0744d7d4_22bb_aeff_2a10_29a93f5cb7d7["resolveDeleteRowConflicts()"]
  3722bac8_b656_267a_d2e2_c3ec91d59be4["generateTableChangeKey()"]
  0744d7d4_22bb_aeff_2a10_29a93f5cb7d7 -->|calls| 3722bac8_b656_267a_d2e2_c3ec91d59be4
  0709c37c_a8e7_9e98_60ff_5c1394265a0a["editOperationMatchesTempId()"]
  0744d7d4_22bb_aeff_2a10_29a93f5cb7d7 -->|calls| 0709c37c_a8e7_9e98_60ff_5c1394265a0a
  d1ec5b53_0ca5_fec8_6eb4_9159f4c4f161["operationMatchesRow()"]
  0744d7d4_22bb_aeff_2a10_29a93f5cb7d7 -->|calls| d1ec5b53_0ca5_fec8_6eb4_9159f4c4f161
  style 0744d7d4_22bb_aeff_2a10_29a93f5cb7d7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/grid/utils/queueConflictResolution.ts lines 48–82

export function resolveDeleteRowConflicts(
  operations: readonly QueuedOperation[],
  deleteOperation: NewDeleteRowOperation
): DeleteConflictResult {
  const rowIdentifiers = deleteOperation.payload.rowIdentifiers

  // Check if this row was newly added (by tempId)
  // If deleting a newly added row, filter out the ADD_ROW operation
  const originalRow = deleteOperation.payload.originalRow
  if (isPendingAddRow(originalRow)) {
    const tempId = originalRow.__tempId
    const addRowKey = generateTableChangeKey({
      type: QueuedOperationType.ADD_ROW,
      tableId: deleteOperation.tableId,
      payload: {
        tempId,
        rowData: originalRow,
        table: deleteOperation.payload.table,
      },
    })

    let filteredOperations = operations
      .filter((op) => op.id !== addRowKey)
      .filter((op) => !editOperationMatchesTempId(op, tempId))

    return { action: 'skip', filteredOperations }
  }

  // For existing rows, remove any pending EDIT_CELL operations for the row being deleted
  const filteredOperations = operations.filter(
    (op) => !operationMatchesRow(op, deleteOperation.tableId, rowIdentifiers)
  )

  return { action: 'add', filteredOperations }
}

Subdomains

Frequently Asked Questions

What does resolveDeleteRowConflicts() do?
resolveDeleteRowConflicts() is a function in the supabase codebase.
What does resolveDeleteRowConflicts() call?
resolveDeleteRowConflicts() calls 3 function(s): editOperationMatchesTempId, generateTableChangeKey, operationMatchesRow.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free