Home / Function/ applyRowAdd() — supabase Function Reference

applyRowAdd() — supabase Function Reference

Architecture documentation for the applyRowAdd() function in queueOperationUtils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  30aae06d_5d4f_f515_1e24_486146dfa430["applyRowAdd()"]
  de0df7eb_b455_d21d_8c6e_09349f59a52a["queueRowAddWithOptimisticUpdate()"]
  de0df7eb_b455_d21d_8c6e_09349f59a52a -->|calls| 30aae06d_5d4f_f515_1e24_486146dfa430
  16d57069_e009_dae3_11f3_3e1e07423636["reapplyOptimisticUpdates()"]
  16d57069_e009_dae3_11f3_3e1e07423636 -->|calls| 30aae06d_5d4f_f515_1e24_486146dfa430
  style 30aae06d_5d4f_f515_1e24_486146dfa430 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/grid/utils/queueOperationUtils.ts lines 79–103

export function applyRowAdd(
  rows: SupaRow[],
  tempId: string,
  idx: number,
  rowData: Dictionary<unknown>
): (PendingAddRow | SupaRow)[] {
  // Check if row with this tempId already exists
  const existingIndex = rows.findIndex((row) => isPendingAddRow(row) && row.__tempId === tempId)
  if (existingIndex >= 0) {
    // Update existing row in place
    return rows.map((row, index) => {
      if (index === existingIndex) {
        return { ...row, ...rowData, __tempId: tempId }
      }
      return row
    })
  }

  const newRow: PendingAddRow = {
    idx,
    ...rowData,
    __tempId: tempId,
  }
  return [newRow, ...rows]
}

Subdomains

Frequently Asked Questions

What does applyRowAdd() do?
applyRowAdd() is a function in the supabase codebase.
What calls applyRowAdd()?
applyRowAdd() is called by 2 function(s): queueRowAddWithOptimisticUpdate, reapplyOptimisticUpdates.

Analyze Your Own Codebase

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

Try Supermodel Free