Home / Function/ GridError() — supabase Function Reference

GridError() — supabase Function Reference

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

Entity Profile

Relationship Graph

Source Code

apps/studio/components/grid/components/grid/GridError.tsx lines 16–56

export const GridError = ({ error }: { error?: ResponseError | null }) => {
  const { filters } = useTableFilter()
  const { sorts } = useTableSort()
  const snap = useTableEditorTableStateSnapshot()

  if (!error) return null

  const tableEntityType = snap.originalTable?.entity_type
  const isForeignTable = tableEntityType === ENTITY_TYPE.FOREIGN_TABLE

  const isForeignTableMissingVaultKeyError =
    isForeignTable && error?.message?.includes('query vault failed')

  const isInvalidSyntaxError =
    filters.length > 0 && error?.message?.includes('invalid input syntax')

  const isInvalidOrderingOperatorError =
    sorts.length > 0 && error?.message?.includes('identify an ordering operator')

  const isHighCostError = error?.message.includes(COST_THRESHOLD_ERROR)

  if (isHighCostError) {
    return (
      <HighCostError
        error={error}
        suggestions={[
          'Remove any sorts or filters on unindexed columns, or',
          'Create indexes for columns that you want to filter or sort on',
        ]}
      />
    )
  } else if (isForeignTableMissingVaultKeyError) {
    return <ForeignTableMissingVaultKeyError />
  } else if (isInvalidSyntaxError) {
    return <InvalidSyntaxError error={error} />
  } else if (isInvalidOrderingOperatorError) {
    return <InvalidOrderingOperatorError error={error} />
  }

  return <GeneralError error={error} />
}

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free