Skip to content

Optimize reorderLists with Supabase RPC bulk update #1

@gdiab

Description

@gdiab

Problem

reorderLists in ListsContext.tsx currently issues N sequential Supabase .update() calls — one per active list — when the user reorders via drag-and-drop or move up/down. This works but is inefficient for users with many lists.

Proposed Solution

Create a Supabase RPC (PostgreSQL function) that accepts an array of {id, sort_order} pairs and performs a single bulk UPDATE statement. Call this RPC from reorderLists instead of looping.

Acceptance Criteria

  • Create a new migration with a reorder_lists(updates jsonb) RPC function
  • Update reorderLists in ListsContext.tsx to call the RPC
  • Verify optimistic UI update still works
  • No regressions in custom sort behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions