Home / Function/ validateMsSqlSorting() — supabase Function Reference

validateMsSqlSorting() — supabase Function Reference

Architecture documentation for the validateMsSqlSorting() function in MsSqlValidation.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  dd8ebed6_bd41_a655_037b_27223ea4d1a6["validateMsSqlSorting()"]
  be97f35c_a68f_0a38_2fc8_b1e46b157381["SupabaseGrid()"]
  be97f35c_a68f_0a38_2fc8_b1e46b157381 -->|calls| dd8ebed6_bd41_a655_037b_27223ea4d1a6
  style dd8ebed6_bd41_a655_037b_27223ea4d1a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/grid/MsSqlValidation.tsx lines 22–52

export const validateMsSqlSorting = ({
  filters,
  sorts,
  table,
}: ValidateMsSqlSortingParams):
  | { warning: MsSqlWarning; Component: ComponentType }
  | { warning: null } => {
  const isMsSql = isMsSqlForeignTable(table)
  if (!isMsSql) return { warning: null }

  const equalityFilterColumns = new Set(
    filters
      .filter((filter) => filter.operator === '=' || filter.operator === 'is')
      .map((filter) => filter.column)
  )

  const conflictingSort =
    sorts.length > 0 && sorts.every((sort) => equalityFilterColumns.has(sort.column))
  const showMsSqlSortWarning = equalityFilterColumns.size > 0 && !!conflictingSort
  if (showMsSqlSortWarning)
    return { warning: 'ConflictingSort', Component: MsSqlSortWarningAdmonition }

  const noSortColumnsRemaining =
    table.columns.length > 0 &&
    table.columns.every((col) => col.data_type === 'json' || equalityFilterColumns.has(col.name))
  const showMsSqlNoValidSortWarning = filters.length > 0 && noSortColumnsRemaining
  if (showMsSqlNoValidSortWarning)
    return { warning: 'NoValidSortPossible', Component: MsSqlNoValidSortAdmonition }

  return { warning: null }
}

Subdomains

Called By

Frequently Asked Questions

What does validateMsSqlSorting() do?
validateMsSqlSorting() is a function in the supabase codebase.
What calls validateMsSqlSorting()?
validateMsSqlSorting() is called by 1 function(s): SupabaseGrid.

Analyze Your Own Codebase

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

Try Supermodel Free